$(document).ready(function() {
var a, b, c;
a = $(window).height(); //浏览器窗口高度 568
var group = $(".Title");
$(window).scroll(function() {
b = $(this).scrollTop(); //页面滚动的高度 600
c = group.offset().top; //元素距离文档(document)顶部的高度 334
console.log(c)
if (b < c) {
$(".Discount_li .opt").addClass("animated rubberBand");
} else {
$(".Discount_li .opt").removeClass("animated rubberBand");
}
});
});
复制代码
转载于:https://juejin.im/post/5afbf0196fb9a07ab83e36b8