Neweralearning Posted November 2 Share Posted November 2 Hi there! Having some issues with this code which works perfectly fine on desktop but not mobile and I can't figure out why. The website is French and English, the language button is meant to bring the user back to the same page they are on but in the other language. This code works fine on desktop but on mobile... it brings the user back to the language button set URL slug. Help! <style> /* hide items on desktop */ nav.header-nav-list>.header-nav-item:nth-child(odd) { display: none; } /* hide items on mobile */ [data-folder="root"]>div:first-child>div:first-child>div:nth-child(odd) { display: none !important; } </style> <script> window.addEventListener('load', function () { document.querySelectorAll(".header-nav-item--external a").forEach(function(t) {t.href = "/fr/our-services"}); }); </script> Link to comment
tuanphan Posted November 4 Share Posted November 4 (edited) Because your script code target Desktop Header Nav items only. What is your site url? We can check Mobile nav easier Edited November 4 by tuanphan Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Neweralearning Posted November 6 Author Share Posted November 6 www.neweralearning.ca Link to comment
tuanphan Posted November 10 Share Posted November 10 Try changing code to this <style> /* hide items on desktop */ nav.header-nav-list>.header-nav-item:nth-child(odd) { display: none; } /* hide items on mobile */ [data-folder="root"]>div:first-child>div:first-child>div:nth-child(odd) { display: none !important; } </style> <script> window.addEventListener('load', function () { document.querySelectorAll('div[class*="-nav-item"] a').forEach(function(t) {t.href = "/fr/our-services"}); }); </script> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care 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