Template:Team:SCUT/mainhead

From 2014.igem.org

(Difference between revisions)
Line 134: Line 134:
li#safety{width:43px;}
li#safety{width:43px;}
-
   #left{position:absolute;top:0px;width:200px;height:800px;z-index:1000;}
+
   #left{float:left;margin-top:0px;margin-left:0px;width:200px;height:800px;z-index:1000;}
   .navihead{width:200px;height:45px;font-size:20px;}
   .navihead{width:200px;height:45px;font-size:20px;}
   .navihead img{width:200px;height:auto;}
   .navihead img{width:200px;height:auto;}
Line 140: Line 140:
   #show{display:block;}
   #show{display:block;}
   .navibody p{margin:20px;line-height:30px;}
   .navibody p{margin:20px;line-height:30px;}
 +
 
   
   
Line 260: Line 261:
$(document).ready(function(){
$(document).ready(function(){
var element = $("#left");
var element = $("#left");
-
         var top = element.position().top + 150;
+
         var dis = element.position().top;
var pos = element.css("position");
var pos = element.css("position");
$(window).scroll(function(){
$(window).scroll(function(){
-
var scrolls = $(this).scrollTop() + 150;
+
var scrolls = $(this).scrollTop();
-
if(scrolls > top)
+
if(scrolls > dis)
{
{
-
element.css({"position":"fixed","top":"150px"});
+
element.css({"position":"fixed","marginTop":"-150px"});
}
}
else
else
{
{
-
  element.css({"position":pos,"top":"0px"});
+
  element.css({"position":"absolute","marginTop":dis,"top":"150px"});
}
}
});
});
Line 276: Line 277:
});
});
</script>
</script>
-
 
</BODY>
</BODY>
</HTML>
</HTML>

Revision as of 06:27, 9 October 2014