1、
//滚动到头部 $('html, body').animate({scrollTop: 0}, 'slow');
2、
$(window).scroll(function () { var scrollY = $(document).scrollTop();// 获取垂直滚动的距离,即滚动了多少 if (scrollY > 100 || scrollY > (winHeight + 100)) { $(".hex-k12-hteSelectExercise>.head").addClass("hover"); } else { $(".hex-k12-hteSelectExercise>.head").removeClass("hover"); } });
3、滚动后距离当前的距离
var scrollTop = $(this).offset().top - document.documentElement.scrollTop - 40;