All things Shopify and commerce
Anchor tags in nav not working. System changes "href" to "data-target" when #'s are used, not sure if that is part of the cause of the problem.
On this page: https://sunshieldplus.com/, you can see the Ingredients link has a "data-target" with the URL and #sectionID, standard anchor tag link added to the menu item. But it does not work.
Please help!
Tyler
Hello @tbenari ,
Make the data-target/href conditional
For homepage your value should be "#shopify-section-sections--16134179586134__newsletter"
and for inner pages it should be "shop-domain/#shopify-section-sections--16134179586134__newsletter"
There is no other issue in it.
Regards
Guleria
Thanks for your answer, though, unfortunately, your recommendation does not fix the issue. The need here may have been clouded by my use of the footer as my example URL for the nav item.
Can you share what you tried with the recommendations I shared?
If you make this navigation conditional it will work 100% btw I'm not sure how good you are with code because without that you cannot implement it.
And with data-target conditional I meant
For homepage data-target should be "#shopify-section-sections--16134179586134__newsletter"
and for inner pages it should be "shop-domain/#shopify-section-sections--16134179586134__newsletter"
Hmmm.. I was able to add Javascript to make the URL for nav items conditional based on the page the user is on, for both desktop and mobile navs.
But, for good usability, I need there to be a consistent animation of the page moving down to the intended section so the user knows they are still on the homepage. Can anyone help?
Any help there?
Yes please follow the example
https://css-tricks.com/snippets/jquery/smooth-scrolling/
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024