jq检测页面滚动到达图片的高度时,把某个菜单置顶,fixed

$( window). scroll( function(){
var imgHeight= $( ".swiper-slide img"). height();//获取图片高度
if( $( window). scrollTop()> imgHeight){
$( ".top_tip"). addClass( "fixed");//fixed是css样式
} else{
$( ".top_tip"). removeClass( "fixed");
}
});

猜你喜欢

转载自blog.csdn.net/qq_40101922/article/details/80972551
今日推荐