标签:window rem border addclass off order ddc bsp fse
#nav.fixed{
position:fixed;
border:1px solid blue;
top:0;
}
$(function(){
var navTop = $("#nav").offset().top;
//alert( navTop )
$(window).scroll(function(){
var scrollTop = $(document).scrollTop();
if ( scrollTop >= navTop )
{
$("#nav").addClass("fixed");
}else{
$("#nav").removeClass("fixed");
}
});
})
标签:window rem border addclass off order ddc bsp fse
原文地址:http://www.cnblogs.com/qiyc/p/6063909.html