• Resolved MrPurplz

    (@mrpurplz)


    I have the following code in a codeblock

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script>
    jQuery(document).ready(function($) {
        var navigation;
    
        navigation = $('#primary-navigation');
    
        navigation.find('a').click(function() {
            navigation.removeClass('toggled-on');
        });
    });
    
    // highlight the current menu item
    jQuery('ul.menu li').each(function() {
    	jQuery(this).removeClass('current-menu-item');
            jQuery(this).removeClass('current_page_item');
    });
    jQuery(thiss).parents('li').addClass('current_page_item');
    jQuery(thiss).parents('li').addClass('current-menu-item');
    </script>

    I’ve applied this to the entire website but it doesn’t seem to be firing. Am I doing something wrong I’ve also tried without the <script>’s

    https://www.ads-software.com/plugins/css-javascript-toolbox/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Okay ignoring that you know putting in HTML is going to break this, this also should be raised:
    You should almost all of the time not enqueue jQuery like this:

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

    The jQuery library is built in to WordPress and is already there, ready for you to use. Actually I’m pretty sure it’s built into this plugin and you don’t have to call it.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Replace all of that code with this:

    jQuery(document).ready(function($) {
        var navigation;
    
        navigation = $('#primary-navigation');
    
        navigation.find('a').click(function() {
            navigation.removeClass('toggled-on');
        });
    });
    
    // highlight the current menu item
    jQuery('ul.menu li').each(function() {
    	jQuery(this).removeClass('current-menu-item');
            jQuery(this).removeClass('current_page_item');
    });
    jQuery(thiss).parents('li').addClass('current_page_item');
    jQuery(thiss).parents('li').addClass('current-menu-item');

    And then link us to the page with the issue

    Plugin Author wipeoutmedia

    (@wipeoutmedia)

    Hi Andrew,

    Thanks for assisting MrPurplz with his support question.
    MrPurplz, let us know how you get on.

    Regards,
    Damian

    Hello guys,

    On another note for you both guys.

    If you want to make sure that a specific JS/CSS is being loaded by WordPress, link it as template from Templates Lookup form.

    Templates lookup form is pushing the scripts to the queue. You can link any WordPress built-in scripts from Templates Lookup form.

    Regards,
    AHMeD

    Plugin Author wipeoutmedia

    (@wipeoutmedia)

    Thank you Ahmed.

    I’m closing this ticket.

    Regards,
    Damian

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘JS doesn't seem to be applying’ is closed to new replies.