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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:23:24+00:00 2026-06-06T14:23:24+00:00

Ok, so I have a carousel that animates left and right. There is the

  • 0

Ok, so I have a carousel that animates left and right.

There is the viewport div of say…1000px wide and a series of divs inside that could total say 5000px. They are all floated left so at any one time, I am looking at only say 4 of the items in the viewport div. What would be the best method to make it infinite. How can I detect that the user has reached the last div in my carousel (going left OR right). Would you remove all elements and reverse the order and append them to the same div? Or some other method? I’m using jQuery…

This is just concept at the moment (the infinite part), so the code isn’t really possible to post. I’m just after potential solutions…

  • 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-06T14:23:27+00:00Added an answer on June 6, 2026 at 2:23 pm

    I guess this is what you did to make a “normal” carousel.
    Suppose the HTML is this:

    <div class="viewport">
        <div class="container">
            <div class="group"> <!-- Without this div probably --!>
                <div class="item"></div>
                <div class="item"></div>
            </div>
        </div>
    </div>
    

    To make it a “carousel” you would make the viewport’s width fixed and the container expand to contain all its children items (with overflow: hidden). When scrolling right, you decrease its left offset, and when scrolling left, you increase its left offset. If the left offset >= 0, you’re at the first item. If the left offset <= -(container width), you’re at the last item.

    You should check for these conditions each time you scroll left/right and accordingly, you will append a copy of the container before/after the “group”, and once the old group is not visible you can remove it. This makes the scrolling smooth, and the position won’t snap from the end to the beginning. However, this might be slow if there are lots of items. So, initially, you could divide your items into many “groups” of 5 for example, and once you reach an end, append a copy of the first/last group, and remove the first/last group.

    Another option would be to scroll in the opposite direction, fast. Instead of snapping to the other end, which does not give visual feedback to the user, you can animate scrolling much faster to the other end. In that case, once the user gets to the end, scrolling stops, and if he scrolls once more, it scrolls back to the beginning, so that he is not surprised of what is happening.

    That’s just my two cents. I once did a carousel, but did not have this feature. I had considered it though, without implementing it.

    Hope it helps.

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

Sidebar

Related Questions

I have a jQuery script that creates a carousel to rotate images left and
I have a carousel that I can change the location of with an integer
I have a simple test app where I have a carousel that will instantiate
I have a carousel with a set of thumbnails inside. When those thumbnails are
I have an item inside a carousel and tied .click() event binding to it.
I have managed to get a carousel so that when the image is changed
I have a carousel that is linked to a list of items, and when
In my page I have a carousel that displays short descriptions of products on
I have a scrolling carousel of images and captions that interact separately but coordinate.
I have a circular jquery carousel that is a representation of a 9 day

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.