Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

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


HobbesSakuga

Question

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 post
  • Answers 5
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Popular Posts

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

5 answers to this question

Recommended Posts

  • 0

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

Link to post
  • 0
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>

 

Link to post
  • 0

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?

Link to post
  • 0
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??

Link to post

Create an account or sign in to comment

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


×
×
  • Create New...