Commit 826687ba by dhn

购物车按钮浮动优化

parent a8854ed1
......@@ -19,3 +19,26 @@
<?php endforeach; ?>
</ul>
<?php endif; ?>
<script>
require(['jquery'], function ($) {
var isMobile = window.matchMedia("(pointer:coarse)").matches;
if (isMobile) {
$(window).scroll(function () {
var checkoutBtn = $('.cart-container .checkout-methods-items li:first-child');
var scrollTop = $(document).scrollTop();
var wh = $(document.body).height();
var offsetTop = $(checkoutBtn).offset().top;
if (wh - offsetTop <= scrollTop) {
if(!$(checkoutBtn).hasClass('button-static')){
$(checkoutBtn).addClass('button-static');
}
} else {
if($(checkoutBtn).hasClass('button-static'))
{
$(checkoutBtn).removeClass('button-static');
}
}
});
}
});
</script>
\ No newline at end of file
......@@ -17,8 +17,8 @@
<div class="item">
<span class="us-icon warranty-icon"></span>
<span class="label">
<span class="title">One Year</span>
<span>Warranty</span>
<span class="title">10%-OFF</span>
<span>SITEWIDE</span>
</span>
</div>
<div class="item">
......
......@@ -886,6 +886,17 @@ p.shopbycate-title {
border: none;
animation-play-state: paused;
}
.checkout-cart-index .cart-container {
row-gap: 0px;
margin-top: 0px;
}
.button-static{
position: static!important;
box-shadow: none!important;
}
.checkout-cart-index .cart-container .checkout-methods-items li:first-child button{
transition: all .3s;
}
}
.checkout-index-index .details-qty,.checkout-cart-index .details-qty{
display: block;
......
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