"No Link" Menu Headers

Hello. In the website I’m working on, I like the menu header to not be clickable and only the dropdown to be selectable. In the past I’ve used a trick I found on another site… I use the Offsite Page type and set the link to http://www.nolink.foo and insert this code into the header:

<script type="text/javascript">
$('#current').addClass("nolink"); 
    $("a[href*='nolink']").addClass("nolink"); 
    $(".nolink").click(function(event){ 
        event.preventDefault();  
}); 
</script>

In the new site, I realized it was no longer working. The old published site still works, however when I open the old site in Rapidweaver, it no longer works. I have idea what changed to make it stop working and would appreciate any suggestions.

New test site: www.familywellnesstreatmentcentre.com/2016
Old site: www.familywellnesshealingspa.com

I have good experience with: http://rapidweaver.marathia.com/stacks/No_Link/

What theme are you using?

I was having this problem a year or two ago. With some themes, simply using ‘#’ as the URL worked. I remembered that I had to change the URL link to javascript:void(0) and it worked (for my particular theme). It may have been theme specific. I use Foundation mostly now and there is an easy fix there but it doesn’t look like you’re using that.

@jabostick is right, I see you are using Freestacks. @macillo’s suggestion is the best way then. If like @jabostick says you were using Foundation, there is a way built into Foundation that makes this VERY easy to do. Good luck!

Thanks everyone. I am using Freestack and the menus are the MyMenus stack. The only thing that I can think of that changed is last week I upgraded to Stacks 3 so maybe that no longer works with my setup. I’ll try the other suggestions here - I’d like to avoid using another stack if possible. (Side note: MyMenus doesn’t work in a Partial so I found out.)

I had problems a year ago with this setup too, but it had to do with putting the code into site-wide. It required a change to the Freestack theme to work properly with site-wide code in Rapidweaver 6.

I just re-read my first message and just in case it wasnt clear - the # and javascript:void(0) options are what you would put in the URL field of an Offsite page. You maybe assumed that already but just in case

If I remember right, we got support tickets asking about this, as Joe did a blog on it, and that was well before Stacks 3 came out, so I doubt it is a S3 issue. We could never figure out how to do it right, but since we have a theme that does this without that extra code, we never investigated it any further.

Good luck!

Neither of these suggestions worked. I don’t understand why the old trick is no longer working. It must be a change in Stacks using the header code. The javascript just opens a blank page, the hashtag just loads the page over and over. Check out my test page… Specialties is using the javascript and Practitioners is using #.

http://familywellnesstreatmentcentre.com/2016/

I found this in another thread and it worked for me:

/* Instructions - Please Read
This snippet will allow you to disable a page’s menu item from linking to the page. This is great if you want a page to act as a placeholder in the menu, forcing visitors to navigate to a sub-page under it.
1 Insert this snippet in the Javascript tab in RapidWeaver’s Page Inspector.
// Insert this snippet in the Javascript tab in RapidWeaver’s Page Inspector.
// You will need to modify the nav link list in the code below
// to contain the name of the pages that you want to disable.
document.addEventListener(“DOMContentLoaded”,function(event) {
// Add your Navigation titles to this list
var nav_titles = [‘Page 1’,‘Page 2’,‘Page 3’,‘Page 4’];
// ------------------------------------------
// Do not modify below this line
var links = document.querySelectorAll(‘ul li a’);
for (var i = 0; i < links.length; i++) {
if (nav_titles.indexOf(links[i].textContent) >= 0) links[i].href = ‘javascript:void(0)’;
}
});

1 Like

Good find! Glad to hear its working