Shopify themes, liquid, logos, and UX
Hi,
I am struggling with the navigation and I do not know where I am going wrong.
I am trying to have subsections, but for some reason, the links only work for the lowest level of navigation.
=> For example, My theme is Dawn update, The top navigation includes "catalog", which works fine on its own.
=>Then I add a section for product types (say 'journals'), then the catalog link does not work anymore. despite working originally.
=> Likewise, if I add size or material as a 'Journals' sub section, neither Catalog nor journals work anymore, despite looking nested, as it should.
Seriously annoying as it would be clearer if all levels worked. I have added collections to go round the problem but makes for a very messy navigation.
Any suggestion?
Solved! Go to the solution
This is an accepted solution.
Hi @NatalieTWB ,
The Dawn theme and many other Shopify themes often handle top-level navigation links differently. By default:
To make both the parent and child links functional, follow these steps:
If the parent links (e.g., "Catalog" and "Journals") are not clickable, the theme may have JavaScript or CSS that disables them when there are submenus. To make them clickable again, follow these steps:
Custom JavaScript Fix: Add custom JavaScript to your theme to allow the parent links to remain clickable even when there are dropdowns.
"document.querySelectorAll('.header__menu-item').forEach(function(menuItem) {
if (menuItem.querySelector('.header__submenu')) {
menuItem.addEventListener('click', function(event) {
if (!event.target.classList.contains('has-submenu')) {
window.location.href = menuItem.querySelector('a').href;
}
});
}
});"
This will allow the user to click both the parent (like "Catalog") and the child links.
2. CSS Adjustment (if necessary): Sometimes, CSS prevents top-level links from being clickable. Ensure that there are no styles blocking the click on parent links by adding this to your CSS:
".header__menu-item.has-submenu > a {
pointer-events: auto !important;
}"
This ensures that top-level links remain clickable even if they have submenus.
Let me know if you need further clarification or assistance!
This is an accepted solution.
Hi @NatalieTWB ,
The Dawn theme and many other Shopify themes often handle top-level navigation links differently. By default:
To make both the parent and child links functional, follow these steps:
If the parent links (e.g., "Catalog" and "Journals") are not clickable, the theme may have JavaScript or CSS that disables them when there are submenus. To make them clickable again, follow these steps:
Custom JavaScript Fix: Add custom JavaScript to your theme to allow the parent links to remain clickable even when there are dropdowns.
"document.querySelectorAll('.header__menu-item').forEach(function(menuItem) {
if (menuItem.querySelector('.header__submenu')) {
menuItem.addEventListener('click', function(event) {
if (!event.target.classList.contains('has-submenu')) {
window.location.href = menuItem.querySelector('a').href;
}
});
}
});"
This will allow the user to click both the parent (like "Catalog") and the child links.
2. CSS Adjustment (if necessary): Sometimes, CSS prevents top-level links from being clickable. Ensure that there are no styles blocking the click on parent links by adding this to your CSS:
".header__menu-item.has-submenu > a {
pointer-events: auto !important;
}"
This ensures that top-level links remain clickable even if they have submenus.
Let me know if you need further clarification or assistance!
Thank you, i will get help with this but that's super helpful, thank you.
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