Commit 445b3cee by dhn

按钮闪烁问题

parent 0d999306
...@@ -24,22 +24,14 @@ ...@@ -24,22 +24,14 @@
var isMobile = window.matchMedia("(pointer:coarse)").matches; var isMobile = window.matchMedia("(pointer:coarse)").matches;
if (isMobile) { if (isMobile) {
$(window).scroll(function () { $(window).scroll(function () {
var checkoutBtn = $('.cart-container .checkout-methods-items li:first-child'); var positionUl = $('.cart-container .checkout-methods-items li:first-child')
var positionUl = $('.checkout-methods-items'); if (window.outerHeight + $(document).scrollTop() < $(positionUl).parent().offset().top + 50) {
var scrollTop = $(document).scrollTop(); $(positionUl).removeClass("button-static");
var wh = $(document.body).height();
var offsetTop = $(positionUl).offset().top;
if (wh - offsetTop <= scrollTop) {
if(!$(checkoutBtn).hasClass('button-static')){
$(checkoutBtn).addClass('button-static');
}
} else { } else {
if($(checkoutBtn).hasClass('button-static')) $(positionUl).addClass("button-static");
{
$(checkoutBtn).removeClass('button-static');
}
} }
}); });
} }
}); });
</script> </script>
\ No newline at end of file
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