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

    oxygen87
    Participant

    Hello,

    I’m experiencing a lot of errors on the background when the site is loaded. Errors like this:

    Uncaught Error: Syntax error, unrecognized expression

    It keeps on going and going when checked with Google chrome. Could you please have a look at it? What do i have to do to make i correct again.

    Greetings

    #728665

    oxygen87
    Participant
    This reply has been marked as private.
    #728690

    Thai
    Moderator

    Hi There,

    Please replace the Javascript code under Customize > Custom > Javascript with this:

    jQuery(function($){
    
    	var window_base = window.location.href.split("#").slice(0)[0];
    	var window_hash = window.location.href.split("#").slice(-1)[0];
    	var outbound    = /^https?:///i;
    
    	$('.x-nav a').each(function(){
    
    		var hash = $(this).attr('href').split("#").slice(-1)[0];
    		var anchor_base = $(this).attr('href').split("#").slice(0)[0];
    
    		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 = $(this).attr('href').split("#").slice(-1)[0];
    
    		if(hash && hash != document.documentURI && !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');
    
    		}
    
    	});
    
    	$(document).ready(function(){
    
    		$('.x-nav li').removeClass('current-menu-item');
    
    		if(window_hash  && window_hash != document.documentURI) {
    			$('a[href$="#'+window_hash+'"]').click();
    		}
    	});
    
    });

    Hope it helps 🙂