Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1292438
    niqujagga
    Participant

    Hi there

    I’m working on this for the last few hours but it’s not working out really. There are many posts about this matter and I tried many different Java-Script solutions but none of them worked out perfecty.

    Its this page I’m talking about: Link

    At the moment, i put the following code into the customizer:

    jQuery(document).ready(function($) {
      $('.x-navbar .x-nav-wrap.mobile a').on('click touchstart',function(){
        $('.x-btn-navbar').click();
      });
    });

    The problem here is, that the outgoing links on my onepage don’t work anymore. With the classic #links, it works fine.

    I found this one:

    jQuery(function($){
      $('.x-nav li a').click(function(e){
        
        var hash = $(this).attr('href').split("#").slice(-1)[0];
        var outbound = /^https?:\/\//i;
    
        if(hash && !outbound.test( $(this).attr('href') )) {
    	    e.preventDefault();
    	    $('html,body').animate({
    	      scrollTop: $('#' + hash ).offset().top - $('header.masthead').height()
    	    },700 ,'swing');
    	    $('.x-btn-navbar').click();
    	}
    
      });
    });

    …which is not working at all.

    Can you help me out on this?

    #1292501
    Lely
    Moderator

    Hi There,

    Can you try using this code instead:

    jQuery(function($){
    
    $('#menu-item-489>a, #menu-item-287>a').on('click touchend', function(e) {
        window.location = $(this).attr('href');
    });
    
    });

    Hope this helps.

    #1293731
    niqujagga
    Participant

    Hello!

    So just to be clear: It’s working now but I’m using this one:

    jQuery(document).ready(function($) {
      $('.x-navbar .x-nav-wrap.mobile a').on('click touchstart',function(){
        $('.x-btn-navbar').click();
      });
    });

    AND this aswell:

    jQuery(function($){
    
    $('#menu-item-489>a, #menu-item-287>a').on('click touchend', function(e) {
        window.location = $(this).attr('href');
    });
    
    });

    Do i understand right, that the second one defines the exceptions and has to be updated, when the menu changes?

    thanks for the support!

    #1293835
    Rad
    Moderator

    Hi there,

    Yes, you’re correct. You’ll have to match #menu-item-287 to your new menu item in case you change it.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1292438 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>