Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8642027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:40:26+00:00 2026-06-12T11:40:26+00:00

I’m stumped. I added a simple jquery function to the footer.php of my wordpress

  • 0

I’m stumped. I added a simple jquery function to the footer.php of my wordpress theme, but it doesn’t seem to do anything. I tried an even simpler hide(); function and that didn’t fire either. I can’t get any jquery to fire at all, but the jquery library is definitely loading into my theme (it’s based on twentyeleven). Here’s my code:

</footer><!-- #colophon -->
</div><!-- #page -->

<script>
jQuery(document).ready(function ($) {
    $(".sub-menu").effect("highlight", {}, 3000);
}); 
</script>


<?php wp_footer(); ?>

</body>
</html>

I loaded the jquery ui core effects via my functions.php and see that it shows up in the site’s resources when I use the Chrome inspector, so the highlight(); function should work.

Here’s the page it should be working on

Why wouldn’t the jquery script be running?

Thanks!

Kenny

EDIT

Final code is the following (Sadly, I don’t know how to make the effect recursive through the <li> elements, but this does the job):

<script>
jQuery(document).ready(function ($) {
setTimeout(function() {
    $('.sub-menu li:first-child').animate({ marginRight: '15px' }, 500);
    $('.sub-menu li:first-child').animate({ marginRight: '0' }, 500);
    setTimeout(function() {
    $('.sub-menu li:nth-child(2)').animate({ marginRight: '15px' }, 500);
    $('.sub-menu li:nth-child(2)').animate({ marginRight: '0' }, 500);
    }, 400);
    setTimeout(function() {
    $('.sub-menu li:nth-child(3)').animate({ marginRight: '15px' }, 500);
    $('.sub-menu li:nth-child(3)').animate({ marginRight: '0' }, 500);
    }, 800);
    setTimeout(function() {
    $('.sub-menu li:nth-child(4)').animate({ marginRight: '15px' }, 500);
    $('.sub-menu li:nth-child(4)').animate({ marginRight: '0' }, 500);
    }, 1200);
}, 3000);

}(jQuery)); 
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:40:27+00:00Added an answer on June 12, 2026 at 11:40 am

    Your script is not running because the $ argument is not defined. The solution is to add (jQuery) after the closing curly braces:

    jQuery(document).ready(function ($) {
        $(".sub-menu").effect("highlight", {}, 3000);
    }(jQuery)); 
    

    This technique is used when multiple libraries (potentially ones that also use $) are present. See Using jQuery with Other Libraries for details.

    Now, it looks like you want to animate the sub-menu list items one by one with a 400 ms delay. You can simplify your code by using .each() and .delay():

    jQuery(document).ready(function ($) {
    
        // iterate over li in .sub-menu
        // NOTE: the overall initial delay is 3000 ms
        $('.sub-menu li').delay(3000).each(function (i) {
    
            // the effect sets margin-right to 15px, then to 0 after completion
            // NOTE: the delay increases by 400 ms for each item
            $(this).delay(i * 400).animate({ marginRight: '15px' }, 500, 'linear', function () {
                // this is the 'complete' callback function
                $(this).animate({ marginRight: '0' }, 500);
            });
    
        });
    
    }(jQuery));
    

    The second part of the animation (setting margin-right to 0) is defined in the complete argument of .animate(), which eliminates one .animate() call. The i * 400 delay creates the cascading effect that you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.