1
我试着用下面的功能,以设置div的从顶部100像素位置滚动100像素之后。集DIV位置滚动100px的固定后?
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(window).scroll(function(){
$("#header").css("top",Math.max(0,100-$(this).scrollTop()));
});
</script>
<div class="header" style="position:fixed;top:100px;background-color:red">something</div>
它不工作(该div坚持它的固定位置)。似乎功能没有涉及到div。什么是我的问题吗?
谢谢,这个工作。 – user1481850 2012-07-05 09:16:21