Jump to content

Issue about hierarchy of pages and pages in a folder of main navigation menu (mobile), code

Recommended Posts

Posted

Hi. 

I want to hide 'Speakers' and 'Schedule' page from navigation bar,

So I used this code.

<style>
	#header .header-nav-item:nth-child(2){
      display:none
  }
    #header .header-nav-item:nth-child(4){
      display:none
  }
  
</style>


<style>
    @media screen and (max-width:1511px){
      #header .header-menu-nav-item:nth-child(2){
        display:none
      }
	@media screen and (max-width:1511px){
      #header .header-menu-nav-item:nth-child(4){
        display:none
      }
    
</style>

 

It was successful on the web, but when it comes to mobile, it makes 'page 1' in the folder dissappear.

I guess it recognizes 'page2' and 'Speakers' as

.header-menu-nav-item:nth-child(2)

at the same time. 

maybe it's because 'page1' is in the folder.

 

Can you guys help me making the hierarchy?

스크린샷 2023-08-10 오후 2.28.50.png

스크린샷 2023-08-10 오후 2.28.58.png

스크린샷 2023-08-10 오후 2.29.09.png

  • Replies 1
  • Views 876
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Posted

You can see my approach to know how to hide these items on desktop/mobile.

Just an example

image.thumb.png.e5305425762da5b98ffb30e2a4b64a5a.png

Next, you can add this code to Page Header  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  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>

 

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!)

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.