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 8108777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:13:09+00:00 2026-06-06T01:13:09+00:00

With jquery i can’t get links working AND animate the anchors’ background both. It

  • 0

With jquery i can’t get links working AND animate the anchors’ background both.
It seems that either one or the other works.

This is the markup:

   <ul class="nav">
   <li> <span id="background"> </span><span id="active"></span><a href="page1.html"     
   class="active">page 1</a> </li>
   <li> <a href="page2.html">page 2</a> </li>
   </ul>

This is the jquery code with which the clicking action happens but not the animation effect:

$("ul.nav a").click(function () {
     $("span#background").fadeIn(800, function () {});
     $("#active").animate({left: "+=2410"}, 950)     
   }); 

The “span” elements have background images via css which is dynamically placed within the active listelement. Thus the active link gets a background and an animated image flying in.
When inserting “return false;” at the end of the jquery code, the animation does run but clicking action is killed.

this is the bare bones testpage:
link to testpage

Thanks anyone who can help!

  • 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-06T01:13:11+00:00Added an answer on June 6, 2026 at 1:13 am

    I looked at your above snippet as well as your testpage and the problem is you want to have a single click that allows the anchor to follow the href AND show animations at the same time.

    There is a better solution. That’s to have the animations occur during mouse over via jQuery .hover() method. Reference HERE

    The testpage example using .hover() is here: jsFiddle

    I took the liberty in changing the animations a bit, but you should get the idea along with the many comments I put in to understand the flow/concept.

    If the .hover() method is not acceptable, then it’s still possible to use a single onclick for everything but then no animations will happen during mouse-over. This jsFiddle uses .click() instead.

    Because .hover() is then used for animations, the anchor tag still can be allowed to function normally when it’s clicked on.

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

Sidebar

Related Questions

i have two jquery(can increase), one of them masterpage and the other is in
JQuery - Can we capture both the p and div tags at a time
JS library like JQuery can be linked directly from other site (e.g. google). Usually
I've read that there is no way that JQuery can download a file directly,
Can JQuery/JavaScript read/get the file content on the client side, where the file is
Using jQuery I can easily get the number of DOM elements used by a
What jquery can I use to change the class that's used in the following
I know that jQuery can programmatically trigger events on DOM elements that are listening
How is it that jQuery can do $(#foo).addClass(bar) and $.ajax() ? I'm creating a
how can hide an element inside an iframe using either JQuery , javascript or

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.