Team:Tianjin/frame/modeling

From 2012.igem.org

(Difference between revisions)
Line 28: Line 28:
});
});
});
});
-
</script>
 
-
 
-
<script type="text/javascript">
 
-
$(function(){
 
-
//获取要定位元素距离浏览器顶部的距离
 
-
var navH = $(".modmenu").offset().top;
 
-
//滚动条事件
 
-
$(window).scroll(function(){
 
-
//获取滚动条的滑动距离
 
-
var scroH = $(this).scrollTop();
 
-
//滚动条的滑动距离大于等于定位元素距离浏览器顶部的距离,就固定,反之就不固定
 
-
if(scroH>=navH){
 
-
$(".modmenu").css({"position":"fixed","top":0,"margin":"5px","width":"170px";});
 
-
}else if(scroH<navH){
 
-
$(".modmenu").css({"position":"static","margin":"5px","width":"170px"});
 
-
}
 
-
console.log(scroH==navH);
 
-
})
 
-
})
 
</script>
</script>

Revision as of 16:54, 20 September 2012