Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #208782

    Lisbeth L
    Participant

    Hi
    My one page navigation doesn’t seem to work properly in Safari. In the top I have a revolution slider full screen (is that the reason?) followed by four content bands. Every time I use the menu to scroll from one point to the other the page seems to load twice.

    http://www.theisogco.dk

    What is causing this and how can I fix it?

    Best regards,
    Lisbeth

    #209081

    Paul R
    Moderator

    Hi Lisbeth,

    Thanks for writing in!

    Do you have any custom javascript added in the customizer?
    Can you try removing it then check your site again in safari.
    If it’s fixed, then you know that it is the one causing the problem.

    Please share your custom code here so that we can check.

    #209515

    Lisbeth L
    Participant

    Hi support

    I do have some javascript in customizer. I used it for the red top bar in the menu to show which menu is active upon scrolling. Is there a way around so I can keep using this? (I removed the red top bar with custom css right now, because it looked wierd with all the content-bands active at the same time)

    Here you have the code:
    // 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’).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);

    });

    BR,
    Lisbeth

    #209805

    Friech
    Moderator

    Hi Lisbeth,

    The one page navigation on safari is working fine on my end. If you wouldn’t mind providing us with a little more clarification, perhaps some screenshots. Also please update your x-shortcode to latest version. To make sure that this is not an compatibility issue.

    Cheers!