Shopify themes, liquid, logos, and UX
Hey there, i want menu animations like that rafaelindiana.com (fadein) just look on mobile.
my site: lefevreandco.com
Hi @lefevreandco ,
You can edit the code in your theme to get the menu animation: You need to edit the code in the following 2 files.
+ component-menu-drawer.css file: Scroll to the bottom of the file and add the following code:
.menu-drawer__menu li {
opacity: 0;
}
+ theme.liquild file: add the following code in the same position as in the image
<script>
document.addEventListener("DOMContentLoaded", function() {
const headerIcon = document.querySelector('.header__icon');
headerIcon.addEventListener("click", function() {
const menuDrawer = document.getElementById('menu-drawer');
const menuItems = menuDrawer.querySelectorAll('.menu-drawer__menu li');
if (menuDrawer.classList.contains('expanded')) {
menuItems.forEach((menuItem, index) => {
menuItem.style.opacity = 0;
menuItem.style.transform = 'translateY(-20px)';
});
menuDrawer.classList.remove('expanded');
} else {
menuItems.forEach((menuItem, index) => {
setTimeout(() => {
menuItem.style.opacity = 1;
menuItem.style.transform = 'translateY(0)';
}, (index + 1) * 150);
});
menuDrawer.classList.add('expanded');
}
});
});
</script>
Hope it helps @lefevreandco
If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here ☕.
B2B Solution & Custom Pricing | Product Labels by BSS
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
I tried it, it worked, but it wasn't what I expected. Very artificial, and doesn't have a smooth transition. Thank you btw!
heyy, it didn't work for me. Can you help me, i want to add transition delay of 0.3s for each page in my mobile menu.
my url: https://8ea630-08.myshopify.com/
Thanks
We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks 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, 2024