我想在向下/向上滚动时更改 div 的固定/相对位置,在
本地工作正常但在服务器上不工作
$(window).scroll(function(){
if($(window).scrollTop()>100)
{
$("#searchBar").css({
'position':'fixed',
'top':'0px',
'left':$("#wrapper").offset().left+1,
'width':$("#wrapper").width()
});
}
if($(window).scrollTop()<=100)
{
$("#searchBar").css({
'position':'relative',
'left':'0px'
});
}
});