Jump to content

Bilingual site: Hide header menu for certain language

Recommended Posts

Site URL: https://karenchan.co

I created a bilingual (Chinese <> English) personal website (https://karenchan.co)

On the header menu, each option has 2 languages (eg. there are homepage(Chinese) and homepage(Eng)

image.thumb.png.e074413a90a42dd0147139338aee077f.png

My goal: When I visit Chinese pages, all English pages on the header menu will be hidden.

I used the below code for Chinese pages (to hide English menu) but nothing happened on my site. 

#collection-6324c402e9e2b1601cc2a36e.header-nav-item:nth-child(even),
#collection-6324c0fd96a62268fb782d0e.header-nav-item:nth-child(even),
#collection-6324c1046efd5f53d3f174ca.header-nav-item:nth-child(even),
#collection-6324c17b751d3b0423ebf3a3.header-nav-item:nth-child(even),
#collection-6324c1ee6efd5f53d3f19d29.header-nav-item:nth-child(even) 
{ 
display: none;
}

May I know what I did wrong?? Thankyou so much!

Edited by karenowl
Link to comment
17 hours ago, karenowl said:

Site URL: https://karenchan.co

I created a bilingual (Chinese <> English) personal website (https://karenchan.co)

On the header menu, each option has 2 languages (eg. there are homepage(Chinese) and homepage(Eng)

image.thumb.png.e074413a90a42dd0147139338aee077f.png

My goal: When I visit Chinese pages, all English pages on the header menu will be hidden.

I used the below code for Chinese pages (to hide English menu) but nothing happened on my site. 

#collection-6324c402e9e2b1601cc2a36e.header-nav-item:nth-child(even),
#collection-6324c0fd96a62268fb782d0e.header-nav-item:nth-child(even),
#collection-6324c1046efd5f53d3f174ca.header-nav-item:nth-child(even),
#collection-6324c17b751d3b0423ebf3a3.header-nav-item:nth-child(even),
#collection-6324c1ee6efd5f53d3f19d29.header-nav-item:nth-child(even) 
{ 
display: none;
}

May I know what I did wrong?? Thankyou so much!

Your code should be

#collection-6324c402e9e2b1601cc2a36e .header-nav-item:nth-child(even),
#collection-6324c0fd96a62268fb782d0e .header-nav-item:nth-child(even),
#collection-6324c1046efd5f53d3f174ca .header-nav-item:nth-child(even),
#collection-6324c17b751d3b0423ebf3a3 .header-nav-item:nth-child(even),
#collection-6324c1ee6efd5f53d3f19d29 .header-nav-item:nth-child(even) 
{ 
  display: none;
}

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
On 9/17/2022 at 10:05 PM, bangank36 said:

Your code should be

#collection-6324c402e9e2b1601cc2a36e .header-nav-item:nth-child(even),
#collection-6324c0fd96a62268fb782d0e .header-nav-item:nth-child(even),
#collection-6324c1046efd5f53d3f174ca .header-nav-item:nth-child(even),
#collection-6324c17b751d3b0423ebf3a3 .header-nav-item:nth-child(even),
#collection-6324c1ee6efd5f53d3f19d29 .header-nav-item:nth-child(even) 
{ 
  display: none;
}

 

Thankyou sooo much! It works!!

May I know what's the difference between my code and yours? Is it the space before certain words? I did not know space matters in coding.

Anyway, you helped a lot, thank you again!

Link to comment
3 hours ago, karenowl said:

 

Thankyou sooo much! It works!!

May I know what's the difference between my code and yours? Is it the space before certain words? I did not know space matters in coding.

Anyway, you helped a lot, thank you again!

You can get reference from here: https://www.w3schools.com/cssref/css_selectors.asp

Here is the difference

image.thumb.png.2a995dc8fb177d2b72cc6a65dff5bdb5.png

Hope it can help

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.