问题出在哪,怎么实现不了导航条随窗口滚动变化
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
$(document).ready(function(){
$(window).scroll(function(){
var top = $(document).scrollTop();
var menue = $("#menue");
var items = $("#content").find(".item");
var currentId = " ";//当前楼层(item)
items.each(function(){
var th = $(this);
var itemtop = th.offset().top;
if(top>itemtop){
currentId = "#"+th.attr("id");
}else{
return false;//如果条件不满足,跳出循环
}
})
//给相应的楼层设置current样式
var currentLink = menue.find(".current");
if(currentId&¤tLink.attr("href")!=currentLink){
currentLink.removeClass("current");
menue.find("[href="+ currentId +"]").addClass("current");
}
})
})
</script>