Jump to content

How to make drop down menus (where the button links to a page) usable on mobile?

Recommended Posts

Site URL: https://wolf-puma-68z2.squarespace.com/

Hi,

I'm about to launch my website and have one hang up that I just noticed.

I really wanted to have drop down menus as my store is a large part of my website. But I didn't like how I couldn't click on the folder button itself. Whenever I clicked on the folder button nothing would happen.

So I used some custom CSS to make it so that clicking on the folder button itself lead to a link. That way I didn't have to have the word "Shop" appearing under a folder that was also called "Shop".

But I realised that this doesn't work on mobile as clicking on a drop down menu opens up the folder and won't show the link that the button itself links to.

Is there any way to make it so the page the folder button links to appears in the drop down menu that shows up on mobile? Without having it show up on desktop as well?

For reference, here's the CSS I'm currently using (it's in advanced, code injection, header:

<script>
  (function()
  {window.addEventListener("load", function () {
    var tours = document.querySelector('[href="/shop-1"]');
    tours.addEventListener("click", function () {
      window.location = "/shop/collections";
    });
  })}
  )();
</script>
<script>
  (function()
  {window.addEventListener("load", function () {
    var tours = document.querySelector('[href="/support-the-community-1"]');
    tours.addEventListener("click", function () {
      window.location = "/support-the-community";
    });
  })}
  )();
</script>
<script>
  (function()
  {window.addEventListener("load", function () {
    var tours = document.querySelector('[href="/about-1"]');
    tours.addEventListener("click", function () {
      window.location = "/about";
    });
  })}
  )();
</script>

 

Here's the password to get into the site: hobbes94!@

Thanks!

Edited by HobbesSakuga
adding site password
Link to comment
  • 4 weeks later...
On 2/28/2021 at 10:19 PM, lbsunfire said:

I am having the same issue. I really don't want to have redundancy in my drop down folders, which I solved through code injection, but it doesn't work on mobile-view. Is there a way around this?

 

www.wolfwillow.org

Edit this code

<script>
$(document).ready(function() { 
	$('.header-nav-folder-title[href="/who-we-are"]').click(function() {
		window.location = "/origin-story";
	});
});
</script>

to this

<script>
$(document).ready(function() { 
	$('.header-nav-folder-title[href="/who-we-are"], .container.header-menu-nav-item [href="/who-we-are"]').click(function() {
		window.location = "/origin-story";
	});
});
</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
On 3/2/2021 at 9:21 PM, lbsunfire said:

Thank you Tuanphan...much appreciated. Although in my mobile view, now when I click on the folder, I can't access the other pages. I'm imagining this is simply a limitation of a site that converts to mobile view?

You want to make folder title clickable or??

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

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.