Jump to content

Drop-down list (remove links) + workaround for mobile

Recommended Posts

Site URL: https://www.lpugh.com/

Hi there, 

Was wondering if you could help me? I am using a folder (titled "Fire Protection") to create a dropdown list in the top menu of a site I'm working on. I want the folder titled "Fire Protection" to link to this page /fireprotection. However, I want the dropdown menu items beneath it to not be linked (essentially an un-clickable list).

I found a code that achieves this on desktop. On mobile, however, when you click on the folder title it just opens up the un-clickable list instead of linking to the page like on desktop. Is there a way to maybe hide the dropdown menu on mobile and just have the folder title direct to /fireprotection?

Thanks in advance!

Link to comment
  • Replies 2
  • Views 276
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Add to Last Line in Code Injection > Footer

<script>
$(document).ready(function() { 
	$('.header-menu-nav-folder[data-folder="root"]>div>div:nth-child(3)').click(function() {
		window.location = "/fireprotection";
	});
});
</script>
<style>
  [data-folder="/fireprotection-folder/"] {
    display: none;
}
  span.chevron.chevron--right {
    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!)

Link to comment
On 6/18/2022 at 3:42 AM, tuanphan said:

Add to Last Line in Code Injection > Footer

<script>
$(document).ready(function() { 
	$('.header-menu-nav-folder[data-folder="root"]>div>div:nth-child(3)').click(function() {
		window.location = "/fireprotection";
	});
});
</script>
<style>
  [data-folder="/fireprotection-folder/"] {
    display: none;
}
  span.chevron.chevron--right {
    display: none;
}
</style>

 

Hi @tuanphan

Thanks for this. When I added this code to the footer Code Injection, and click "Fire Protection" on mobile, it open up to a blank menu (see screenshot attached), but doesn't open to the /fireprotection page. Any idea what I might be doing wrong? 

Thanks so much!

Screen Shot 2022-06-19 at 10.58.18 PM.png

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.