Commit 826687ba by dhn

购物车按钮浮动优化

parent a8854ed1
...@@ -19,3 +19,26 @@ ...@@ -19,3 +19,26 @@
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php endif; ?> <?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 @@ ...@@ -17,8 +17,8 @@
<div class="item"> <div class="item">
<span class="us-icon warranty-icon"></span> <span class="us-icon warranty-icon"></span>
<span class="label"> <span class="label">
<span class="title">One Year</span> <span class="title">10%-OFF</span>
<span>Warranty</span> <span>SITEWIDE</span>
</span> </span>
</div> </div>
<div class="item"> <div class="item">
......
...@@ -886,6 +886,17 @@ p.shopbycate-title { ...@@ -886,6 +886,17 @@ p.shopbycate-title {
border: none; border: none;
animation-play-state: paused; 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{ .checkout-index-index .details-qty,.checkout-cart-index .details-qty{
display: block; 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