Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1176727
    j r
    Participant

    Hi I found a java code on the forum that I’m using so I can use one page menu and global menu links together. The code works well and does the job but I just noticed that the code breaks the toggle functionality in my tabs using both visual composer and x theme short code.

    Any fix for this? ( I still need the one page menu and global menu links together) code is below.

    // Conditions
    // 1. Menu should be using full url, eg. http://site.com/#x-content-band-1 and not just #x-content-band-1
    // 2. Use just one menu for both Primary and One Page.

    jQuery(function($){

    var window_base = window.location.href.split(“#”).slice(0)[0];
    var window_hash = window.location.hash == ” ? ‘body’ : ‘#’+window.location.href.split(“#”).slice(-1)[0];
    var outbound = /^https?:\/\//i;

    $(‘.x-nav a’).each(function(){ //Scan links and convert them to relative hash for one page navigation’s Active statuses to work properly when manually scrolling

    var hash = /#/.test( $(this).attr(‘href’) ) ? ‘#’ + $(this).attr(‘href’).split(“#”).slice(-1)[0] : ”;
    var anchor_base = /#/.test( $(this).attr(‘href’) ) ? $(this).attr(‘href’).split(“#”).slice(0)[0] : $(this).attr(‘href’);

    if(hash) { //Does it have hash? then perform check
    if(anchor_base == window_base) { //If same page, then no need to reload, just make it relative
    $(this).attr(‘href’, hash);
    } // Else, leave it that way. So when user clicked, it will just link them to outbound page
    }

    }).click(function(e){ //Enable Parent and Submenu scrolling

    var hash = /#/.test( $(this).attr(‘href’) ) ? ‘#’ + $(this).attr(‘href’).split(“#”).slice(-1)[0] : ‘body’;

    if(hash && !outbound.test( $(this).attr(‘href’) ) ) { //Does it have relative hash?

    e.preventDefault(); //Disable jumping
    e.stopPropagation();

    $(‘html,body’).stop().animate({ scrollTop: $( hash ).offset().top – $(‘.x-navbar’).height()},700 ,’swing’);

    //Now add active status for automatic scrolling
    $(‘.x-nav li’).removeClass(‘current-menu-item’);
    $(this).parent().addClass(‘current-menu-item’);

    }

    });

    //$(‘html,body’).css({ scrollTop : 0});
    setTimeout( function(){
    $(document).ready(function(){ // Enable auto scroll when loaded.
    $(‘.x-nav li’).removeClass(‘current-menu-item’);
    //$(‘a:not([href*=”#”])’).parent().addClass(‘current-menu-item’); For experiment only

    if(window_hash) {
    $(‘a[href$=”‘+window_hash+'”]’).click(); //Click it, so it will use default click from one page navigation event and submenu event
    }
    }); }, 300);

    })

    Regards

    #1176732
    j r
    Participant
    This reply has been marked as private.
    #1177171
    Jade
    Moderator

    Hi there,

    You could try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

    Let us know how it goes.

    #1177187
    j r
    Participant

    Hi,
    It doesn’t seem like you read my post? The problem is the java code I’m using for the one page menu. I got this code from some else post here is the link https://community.theme.co/forums/topic/page-links-using-ids/page/2/#post-98964 this code works fine for what its supposed to do but the issue is that this code brakes the tabs functionality and are not clickable. When clicked it just takes the user back to the top of the page. When I remove this code the tabs work fine no issues.
    Any suggestions?

    Thanks

    #1177629
    Lely
    Moderator

    Hello There,

    I did check the page and I can see the following error on the console:
    sh.81a142d….html:1 Uncaught TypeError: (t.data || "").search is not a functionpmh @ sh.81a142d….html:1
    It is coming from Addthis code. Custom code have conflict with Addthis. This error that was thrown by Addthis stops tabs fron working. Can you try disabling Addthis and try again? If this doesn’t work, please do give us admin credentials on a private reply.

    #1178206
    j r
    Participant
    This reply has been marked as private.
    #1178747
    Rad
    Moderator

    Hi there,

    The page is being cut off, all other scripts are not loaded either.This could be an internal server error. Would you mind providing your FTP login credentials as well?

    Thanks!

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