Support » Plugin: Advanced AJAX Page Loader » Click Code not working correctly

  • Hi, I’m having an issue getting the Click Code to function correctly. The .current-menu-item class isn’t applied to the link I clicked until after the AJAX has finished loading, which leaves a few seconds in which no link is identified as the current one. I’d like to correct this so that the .current-menu-item class is applied to the new link element as soon as it’s clicked.

    This is the code that I currently have:

    // highlight the current menu item
    jQuery('.main-nav-item').each(function() {
    	jQuery(this).removeClass('current-menu-item');
    });
    jQuery('.main-nav-item').each(function() {
    	jQuery(this).removeClass('current-menu-item');
    });
    jQuery(thiss).parents('.main-nav').addClass('current-menu-item');

    The first two parts (which I’m just now noticing are identical?) seem to be working correctly – the .current-menu-item class is being removed from the other elements when I click on the new one. However, I need the .current-menu-item class to be applied to the clicked link the second it’s clicked.

    Thanks in advance for your assistance!

    http://wordpress.org/extend/plugins/advanced-ajax-page-loader/

  • The topic ‘Click Code not working correctly’ is closed to new replies.