Jump to content

Make a folder clickable in mobile view to avoid menu drop down

Recommended Posts

Posted

Site URL: https://rthglmr.squarespace.com

Password: rthglmr!

 

Hello, 
I have managed to come quite far in my website with learning CSS but now I am SUUUUPER stuck. I am trying to have the same navigation on my desktop and mobile site.

The desktop is working exactly how I wish it to and now I need the folders to be clickable onto a page on the mobile view. I would like to avoid the drop-down text menu and instead link to a page that is more visual.

I would really appreciate any wisdom or insight on this!

  • Replies 2
  • Views 570
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

I have tried many different codes, the most recent being this one by @tuanphan but cannot find any success

 

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
$(document).ready(function() { 
    $('button.Mobile-overlay-nav-item.Mobile-overlay-nav-item--folder:nth-child(2)').click(function() {
        window.location = "/portfolio";
    });
});
</script>

Posted
On 5/18/2022 at 7:12 PM, rrrrrrrrr said:

I have tried many different codes, the most recent being this one by @tuanphan but cannot find any success

 

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
$(document).ready(function() { 
    $('button.Mobile-overlay-nav-item.Mobile-overlay-nav-item--folder:nth-child(2)').click(function() {
        window.location = "/portfolio";
    });
});
</script>

I see mobile works here?

It looks like you solved with this code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
   $('.header-nav-folder-title[href="/portfolio_"], [data-folder-id="/portfolio_"]').click(function() {
    window.location = "https://rthglmr.squarespace.com/portfolio";
});

 $('.header-nav-folder-title[href="/publications_"], [data-folder-id="/publications_"]').click(function() {
    window.location = "https://rthglmr.squarespace.com/publications";
});

  $('.header-nav-folder-title[href="/text_"], [data-folder-id="/text_"]').click(function() {
    window.location = "https://rthglmr.squarespace.com/text";
});
</script>

 

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.