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

  • Home
  • SEARCH
  • 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 4334930
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:36:01+00:00 2026-05-21T10:36:01+00:00

I need to delay a little bit redirection to a new page after clicking

  • 0

I need to delay a little bit redirection to a new page after clicking on certain links.

Right now I’m using following jQuery:

$('.menu-element a').click(function(){
    var src = $(this).attr('href');
    $(this).removeAttr('href');             
    anim(src);
})

And it works fine. It runs really short animation and after that redirects to clicked page.

But I would like to keep the href attribute of link (i.e. in case when someone clicks twice very fast).

when I add $(this).attr('href', src); at the end of code listed above, it doesn’t wait for animation to finish only redirects to new page right after clicking on the link.

How can I preserve the href property and avoid the page being redirected to new address by it?

  • 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-05-21T10:36:02+00:00Added an answer on May 21, 2026 at 10:36 am

    add return false into your function. This prevents the browser following the link’s href, and is then up to you to make that redirect in your javascript. e.g. by adding something to the end of your anim() function that updates the location.

    It also means you don’t need to remove the href from the link.

    $('.menu-element a').click(function(){
        var src = $(this).attr('href');
        anim(src);
        return false;
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to delay the execution of the 2nd function crumble() after stackUp() has
I am very new to ffmpeg and beanstalk and I need a little help.
I have taken to the following code which will call CFRelease after a delay.
I need a little bit of help here. First off, I am not sure
I need to call a function after a CCSpeed delay so that I can
I need a delay on my dropdownmenu. i tried to use, hoverintent but its
Im building a Reversi program and i need to delay the program for something
I'm writing a UDP multicast client/server pair in C# and I need a delay
I need to put a one second delay in this jQuery function so that
I need to create async thread that runs once with a delay of 2

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.