Shopify themes, liquid, logos, and UX
How can you make it so that the menu is only kept open when the mouse is over it, but when you leave the menu square that opens, it closes?
Thanks you!
Solved! Go to the solution
This is an accepted solution.
@ArnauP ,
Step 1. Go to Admin -> Online store -> Theme > Edit code
Step 2. Find the file theme.liquid
Step 3: Add this code before </body> tag
<style>
header-menu [open] summary:after {
content: "";
position: absolute;
height: 2em;
top: 3em;
left: -2em;
right: -2em;
}
</style>
<script>
let items = document.querySelectorAll(".header__inline-menu details");
items.forEach(item => {
item.addEventListener("mouseover", () => {
item.setAttribute("open", true);
item.querySelector("ul").addEventListener("mouseleave", () => {
item.removeAttribute("open");
});
item.addEventListener("mouseleave", () => {
item.removeAttribute("open");
});
});
});
</script>
Hope it helps 😍
B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.
B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.
B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.
BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now
This is an accepted solution.
@ArnauP ,
Step 1. Go to Admin -> Online store -> Theme > Edit code
Step 2. Find the file theme.liquid
Step 3: Add this code before </body> tag
<style>
header-menu [open] summary:after {
content: "";
position: absolute;
height: 2em;
top: 3em;
left: -2em;
right: -2em;
}
</style>
<script>
let items = document.querySelectorAll(".header__inline-menu details");
items.forEach(item => {
item.addEventListener("mouseover", () => {
item.setAttribute("open", true);
item.querySelector("ul").addEventListener("mouseleave", () => {
item.removeAttribute("open");
});
item.addEventListener("mouseleave", () => {
item.removeAttribute("open");
});
});
});
</script>
Hope it helps 😍
B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.
B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.
B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.
BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now
That's Exactly what i need, thanks BSSCommerce.
You're welcome! 😊
B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.
B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.
B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.
BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024