-
AuthorPosts
-
January 2, 2016 at 10:21 am #728664
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
January 2, 2016 at 10:22 am #728665This reply has been marked as private.January 2, 2016 at 11:04 am #728690Hi 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 🙂
-
AuthorPosts