dross Posted December 20, 2023 Share Posted December 20, 2023 Hello all, In the main nav on the website I'm working on, two of the pages in the main nav are just links to specific category pages in the shop. I removed the "all' from the shop. The client wants to land on "best sellers" when people click the shop button in the top nav. The issue is that the "shop" nav doesn't show as active when in the store using this method. Is there some code I could use that I could insert into each category page for the shop, that would show the top/main nav as active when visiting that page? Hopefully this makes sense. Link to comment
tuanphan Posted December 22, 2023 Share Posted December 22, 2023 Hi, What is your site url? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
dross Posted December 22, 2023 Author Share Posted December 22, 2023 12 hours ago, tuanphan said: Hi, What is your site url? https://www.lewisrossignolart.com Link to comment
tuanphan Posted December 24, 2023 Share Posted December 24, 2023 You mean when users is on this page https://www.lewisrossignolart.com/original-artwork/best-sellers will make "Shop" item change color + add a line, like this? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
dross Posted December 24, 2023 Author Share Posted December 24, 2023 4 hours ago, tuanphan said: You mean when users is on this page https://www.lewisrossignolart.com/original-artwork/best-sellers will make "Shop" item change color + add a line, like this? Exactly. That's precisely what I'm trying to do. Link to comment
Solution tuanphan Posted December 25, 2023 Solution Share Posted December 25, 2023 18 hours ago, dross said: Exactly. That's precisely what I'm trying to do. Add this code to Website Tools (under Not Linked) > Code Injection > Footer <script> if (document.location.pathname.indexOf("/original-artwork/") == 0) { document.querySelector('body').classList.add('shop-artwork') } </script> <style> body.shop-artwork header#header div.header-nav-item:first-child [href*="original-artwork"] { color: #f56400 !important; text-decoration: line-through !important; } </style> sayreambrosio 1 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
dross Posted December 25, 2023 Author Share Posted December 25, 2023 Thank you so much. Worked exactly as I'd hoped it would. tuanphan and sayreambrosio 2 Link to comment
tuanphan Posted December 28, 2023 Share Posted December 28, 2023 I forgot, the code doesn't work on mobile, you can use this new code <script> if (document.location.pathname.indexOf("/original-artwork/") == 0) { document.querySelector('body').classList.add('shop-artwork') } </script> <style> body.shop-artwork header#header div.header-nav-item:first-child [href*="original-artwork"] { color: #f56400 !important; text-decoration: line-through !important; } body.shop-artwork header#header div.container.header-menu-nav-item:first-child [href*="original-artwork"] { color: #f56400 !important; text-decoration: line-through !important; } </style> dross 1 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment