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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:39:06+00:00 2026-06-08T21:39:06+00:00

I create a button that when it is clicked, moves some images but when

  • 0

I create a button that when it is clicked, moves some images but when I click quickly the button, jQuery create an error on the movement of the images. So I want disable the button untill that the .animate() function isn’t finish. I tryed write this code but isn’t correct.

var next = $('.next');

function nextAction(e){
    e.preventDefault();
    next.off('click');
    if(pellicle.css('left').replace(/[^-\d\.]/g, '') <= -(stepTotalWidth - screenWidth)){
        pellicle.animate({
            left:'0'
        },1000, function(){next.on('click', nextAction);});
    }
    else {
        pellicle.animate({
            left:'-=' + screenWidth
        },1000);
    }
}

next.on('click', nextAction);
  • 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-08T21:39:07+00:00Added an answer on June 8, 2026 at 9:39 pm

    You can attach and detach events as many as you want, i didn’t get what is the question exept that you have o problem with click in period when you ‘off’ event while animation running.

    For this you can attach another event that will prevent default and second will run animanion

    function nextAction(e){
        next.off('click.gallery'); //detach by namespace
        next.off('click', nextAction); //detach by link on function
    
        //Your code and again attach animation click
    }
    
    
    next.on('click', function(e){ 
      e.preventDefault(); 
    });
    
    next.on('click.gallery', nextAction); 
    /* .gallery is not necessary if you will detach events 
    by the link on the function that attached to that */
    

    The second thing is that pellicle.css('left') is always returns ***px in that case a bit faster than regexp would be parseInt(pellicle.css('left'), 10) || 0 it will always give you a number in that case.

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

Sidebar

Related Questions

I want to create a button that has a jQuery click on the fly.
I want to create a jQuery control that allows me to view images (say;
I would like to create a button that when clicked a static image is
I'm trying to create a jTable that, once a button is clicked, adds rows
I'm using RoR 3.1 and Twitter Bootstrap, and want to create a button that
i want to create a button that allows the user to tap on it
I'm trying to create a button that, when clicked will cycle ad nauseum through
I'm trying to create a button that performs some actions from my controller when
I have a jQuery function that when a certain button is clicked it removes
Is it possible to use JQuery & PHP to create a like button that

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.