Shopify themes, liquid, logos, and UX
I have sticky add to cart bar and want to scroll function to it. Need help to add below js code like where to add in global.js to get exact scroll function so that sticky add to cart bar will only appear after scroll. Using shopify 2.0 dawn theme.
$(window).scroll(function (event) {
var height = $(window).height();
var scroll = $(window).scrollTop();
//console.log(scroll + " " + height);
if(scroll > height){
$(".sticky_cart").addClass("show");
} else {
$(".sticky_cart").removeClass("show");
}
});
$("#btn-sticky-cart").click(function(){
$(".paymentButtonsWrapper #AddToCart").click();
});
Solved! Go to the solution
This is an accepted solution.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
you should put this code at the very bottom of your gobal.js file. So it will be handy to find and change it later.
where you have added the code. there is not code in your theme global.js file
https://cdn.shopify.com/s/files/1/0337/3737/5879/t/37/assets/global.js
plz also add jquery to your theme
This is an accepted solution.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
that's nice!
one more thing the product image overlaps the bar plz add the following code at the bottom of "base.css"
.sticky_cart{
z-index: 99999;
}
plz replace 99999 with just 99
and also one more thing
.sticky_cart{
z-index: 99;
padding-right: 110px;
}
plz share the store URL.
We now offer a sticky cart solution with a free plan. It works with all themes, check it out: https://apps.shopify.com/pasilobus-sticky-cart
Here is the solution to add sticky add to cart bar in your store:
Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024Note: Customizing your CSS requires some familiarity with CSS and HTML. Before you cust...
By JasonH Aug 12, 2024