Commit 445b3cee by dhn

按钮闪烁问题

parent 0d999306
......@@ -24,22 +24,14 @@
var isMobile = window.matchMedia("(pointer:coarse)").matches;
if (isMobile) {
$(window).scroll(function () {
var checkoutBtn = $('.cart-container .checkout-methods-items li:first-child');
var positionUl = $('.checkout-methods-items');
var scrollTop = $(document).scrollTop();
var wh = $(document.body).height();
var offsetTop = $(positionUl).offset().top;
if (wh - offsetTop <= scrollTop) {
if(!$(checkoutBtn).hasClass('button-static')){
$(checkoutBtn).addClass('button-static');
}
var positionUl = $('.cart-container .checkout-methods-items li:first-child')
if (window.outerHeight + $(document).scrollTop() < $(positionUl).parent().offset().top + 50) {
$(positionUl).removeClass("button-static");
} else {
if($(checkoutBtn).hasClass('button-static'))
{
$(checkoutBtn).removeClass('button-static');
}
$(positionUl).addClass("button-static");
}
});
}
});
</script>
\ No newline at end of file
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment