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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:08:23+00:00 2026-05-16T08:08:23+00:00

I am attempting to create an image gallery. At the bottom I have a

  • 0

I am attempting to create an image gallery. At the bottom I have a strip of thumbnails these thumbnails slide left and right when you click an arrow but if you click the arrow multiple times it ques the function.

I would like to remove the click handler while the function is run, then replace it again.

On a side note, my thumbnail scroller uses margin-left to animate, is it possible to use scrollTo or similar, to move an element a specific amount, horizontally, so if the thumbnails change size, it would still work?

  • 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-16T08:08:24+00:00Added an answer on May 16, 2026 at 8:08 am

    There are many ways to do this. The easiest way is not to remove the click handler, but simply do nothing in the callback if it’s animating already, eg:

    $('.thumb').click(function() {
        if ($('#thumb-strip:animated').size() != 0)
            return;
    
        /* else animate #thumb-strip */
    });
    

    If you want to remove the click handler, and add it before, just do this:

    var animateHandler = function() {
        var params = {}; // animate params
        $('.thumb').unbind('click', animateHandler); // unbind the click handler
        $('#thumb-strip').animate(params, function() {
            $('.thumb').click(animateHandler); // re-bind the click handler when animation is done
        });
    };
    $('.thumb').click(animateHandler);
    

    Needless to say, the first way is simpler.

    However what I usually do is not prevent the click event from happening, because the user won’t expect that, but I also want to get rid of the queuing of animations. So what you can do is allow the user to click a thumb, and make it instantly animate to the new place with stop:

    $('.thumb').click(function() {
        var params = {}; // animate params
        $('#thumb-strip').stop().animate(params);
    });
    

    This is the simplest and most intuitive solution.

    And to answer your second question, you can use $(this).position() to get the thumb’s relative position to the parent, and then animate based on that.

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

Sidebar

Related Questions

I have an Image declared in some XAML as: <Image Width=188 Height=56 HorizontalAlignment=Left VerticalAlignment=Bottom
I am attempting to create a content based image retrieval system (CBIR) in MATLAB
I attempting to create custom tabs using this . But when I try to
I'm attempting to create a true mosaic application. At the moment I have one
I am attempting to call ffmpeg to create an image from a frame in
I'm attempting to create a custom button using a background image in Interface Builder.
I'm attempting to create thumbnails out of some images, each of which isn't necessarily
I'm attempting to add this .click function to each image I'm sorting with the
I'm attempting to create a very large image in Java like so: BufferedImage bi
I am attempting to create and store a jpeg image on the fly with

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.