Sophie16 Posted August 15, 2023 Share Posted August 15, 2023 My website (www.realchineseacademy.com) is in two languages which I've done manually by duplicating every page with translated text. I added code to each page so that being on the English pages will only make you see the English navigation links and vice versa for Chinese. Everything works fine for English pages on both desktop and mobile and Chinese pages on desktop. However on the Chinese pages on mobile when you click on any of the navigation links that have a drop down menu the page with the drop down does not display anything. I've used the exact same code for all pages, just replacing the numbers for the different language headers so not sure why it is not working only for these pages and only on mobile? Any help is appreciated! Link to comment
Solution tuanphan Posted August 16, 2023 Solution Share Posted August 16, 2023 I wrote a quick guide to achieve this, you can see an example below Next, you can add this code to Page Header (on all language 1 pages) to hide Items 3, 4, 5 <style> /* hide items on desktop */ nav.header-nav-list>div:nth-child(3), nav.header-nav-list>div:nth-child(4), nav.header-nav-list>div:nth-child(5) { display: none; } /* hide items on mobile */ [data-folder="root"]>div:first-child>div:nth-child(3), [data-folder="root"]>div:first-child>div:nth-child(4), [data-folder="root"]>div:first-child>div:nth-child(5) { display: none; } </style> Next, add this code to Page Header (on all language 2 pages) to hide Items 1, 2, 3 <style> /* hide items on desktop */ nav.header-nav-list>div:nth-child(1), nav.header-nav-list>div:nth-child(2), nav.header-nav-list>div:nth-child(3) { display: none; } /* hide items on mobile */ [data-folder="root"]>div:first-child>div:nth-child(1), [data-folder="root"]>div:first-child>div:nth-child(2), [data-folder="root"]>div:first-child>div:nth-child(3) { display: none; } </style> Based on the above example, you can adapt the code more precisely for your case. If you still can't solve the problem, you can let me know, I will tweak code for your site 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
Sophie16 Posted August 16, 2023 Author Share Posted August 16, 2023 This has worked - thank you for your help! 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