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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:21:05+00:00 2026-05-31T17:21:05+00:00

I have a simple animation the problem is I want the animation to end

  • 0

I have a simple animation the problem is I want the animation to end before I can click again?

$(".next").click(function() {

 $('#result').animate({
    left: '-=250',
   }, 1000, function() {
  pos = $('#result').position();

  if (pos.left <= -550) {
$('.next').hide();
  }
  if (pos.left <= -250) {
    $('.prev').show();
  }
});
  • 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-31T17:21:07+00:00Added an answer on May 31, 2026 at 5:21 pm

    The answer is simple, use the .data() method to set a clickable flag on the item. You can re-enable it in your complete function.

    From jQuery.com: .data() Documentation

    The .data() method allows us to attach data of any type to DOM elements in a way that is safe from circular references and therefore from memory leaks.

    We can set several distinct values for a single element and retrieve them later:

    Using the complete method on your animation (Which you’re already using to show/hide your next / previous buttons, we can re-enable the button to be clicked.

    Note that we store $(this) into btn so it can be accessed from the closure of the complete function.

    $(".next").click(function() {
      var btn = $(this);
      if (btn.data('running'))
        return;
    
      btn.data('running', true);
    
      $('#result').animate({
        left: '-=250',
        }, 1000, function() {
           pos = $('#result').position();
    
           if (pos.left <= -550) {
             $('.next').hide();
           }
           if (pos.left <= -250) {
             $('.prev').show();
           }
    
           // Unset it here, this lets the button be clickable again
           btn.data('running', false);
        }
       );
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple problem using Jquery. I want to display detailed information under
I want to implement a simple animation based on UIView's center property. I have
I have a simple jQuery hover animation: jQuery(function($) { $('.category').hover(function(){ $(this).find('.banner').fadeIn(); },function(){ $(this).find('.banner').fadeOut(400); });
I have a simple jquery animation on a div, which is inside a div,
i have a very simple animation in flash CS4. My image travels from point
I have a simple UIView animation block. In the block, I only change the
I have an ImageView and I do a simple scale animation to it. Very
I have made a simple animation in Flash and the i exported into a
I have a simple problem that I cannot seem to find a solution to.
WPF Windows-XP SP3 I'm having a problem with a simple WPF animation. I use

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.