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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:29:04+00:00 2026-05-31T15:29:04+00:00

I have say 5 list items with images inside placed 200px from eachother. I

  • 0

I have say 5 list items with images inside placed 200px from eachother.
I am trying to animate these list items to slide horizontally left if one presses a link with the id = #next or if one swipes left. And vice versa for sliding the list items right.

Every click or swipe results in a slide animation of 200px on every list item.
I ran into a problem where spamming the #next or #prev button would cancel the current animation and start a new one. This results in list items not sliding 200px+200px+200… but something like this 200px+140px+120… This because like I said the animation is cut and therefore the sliding distance will be shorter.

Now I solved this for the clicking event by disabling the button before the animation starts and then re’enabling it on the end callbak function. But this problem is remaining for the swipe event.

How can I solve this problem for the swipe event?

  • 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-31T15:29:06+00:00Added an answer on May 31, 2026 at 3:29 pm

    If you have the code working for your click event handlers, then just .trigger() a click event on the proper element for each of the swiperight and swipeleft events:

    $(document).delegate('#next', 'click.my-namespace', function () {
        ...
    }).delegate('#prev', 'click.my-namespace', function () {
        ...
    }).delegate('#my-page-id', 'swipeleft swiperight', function (event) {
        if (event.type == 'swipeleft') {
            $('#next').trigger('click.my-namespace');
        } else {
            $('#prev').trigger('click.my-namespace');
        }
    });
    

    This way you have a single base of code that does the same thing, that gets called by multiple event handlers. I like to do this when I am adding touch events to a desktop design.

    Notice I bound the event handlers with name-spaces so you don’t accidentally trigger the wrong event handler.

    You can also use .stop(true, true) but it may make your animations jittery when playing many in a row. The best solution when using .stop() is to always animate to an absolute value, never use +=200px, that way when you use .stop() the animation can be stopped and instantly restarted to the new absolute position: http://api.jquery.com/stop

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

Sidebar

Related Questions

Say I have a list of items from a database. Next to each item
I have a list of items lets say for example a, b, c. As
I have a ListBox bound to a list of Items (for arguement, lets say
Let's say I have a somewhat large (several millions of items, or so) list
i have a list of say courses and certificates and fun_days . These are
I have a list of say, 20 items. Each of them are boxes in
Let's say I have a class Collection which holds a list of Items. public
I have a list of items & they are holding images, each image is
Let's say I have an unordered list element displaying list items across a horizontal
say i have a list of items which some of them are similiar up

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.