Menu onclick handlers block clicks

Support Forums Cian – WP Theme Menu onclick handlers block clicks

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5411
    Antonio Agudo
    Participant

    I have built a menu that links to a couple of pages. I noticed that for some reason the clicks to the menu gets blocked for these pages. There is a javascript handler attached to the “a” elements that seems to interfere with proper navigation. Right-click-open still works though. Any ideas what this could be?

    #5412
    Antonio Agudo
    Participant

    Did a little research and found that the menu adds the scrollTo class to all menu items regardless if they are on page or not and then this code gets added, which leads to “regular” links that point away from the home page being unusable.

    		jQuery('.navbar-nav > li.scrollTo > a').bind('click', function(e) {
    		    e.preventDefault();
    		    var target = this.hash;
    		    jQuery.scrollTo(target, 1250, {
    		    	easing: 'swing',
    		    	axis: 'y',
    		    	offset: -45
    		    });
    		});
    

    Am I correct to assume the menu was built to only support onpage anchor links?

    #5413
    CreaboxThemes
    Keymaster

    Hi,

    If you want to add an external link to the menu, you have to follow the next steps::

    1. Create a custom link in the page Appeareance > Menu
    2. Load the website and copy the ID of the menu link. You have to read the source code to get it.
    3. Go to the page Appearance > Theme Options > Custom Scripts, and type the next code in the option Custom JS. With this code you will disable the function ScrollTo for this link:
      jQuery("#menu-id").removeClass("scrollTo");

    Regards

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.