// 随滚动条浮动 $('.Step_points').width($('.Leftbox').width()); var Step_points_top=$('.Step_points').offset().top; $(window).scroll(function(){ console.log($(window).scrollTop()); if($(window).scrollTop()>Step_points_top){ $('.Step_points').addClass('fixed'); }else{ $('.Step_points').removeClass('fixed'); } });