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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:58:23+00:00 2026-06-14T19:58:23+00:00

I have a carousel with different lists. And i have a button next. When

  • 0

I have a carousel with different lists. And i have a button next. When i click on the button, the carousel move 200 pixels to left. Than you can see the other images. But i have a problem with this custom made carousel.

I put the script on Jsfiddle: http://jsfiddle.net/kwdMP/2/

I would like to get the .index of the carousel. But the carousel is not working with .index. Who can help me, to fix this carousel? Thank you help guys!

This is my js code:

$(document).ready(function() {
    // Add width en height to the container - wrapper
    var ul = $('.list-thumbnails');
    var lengthUL = $('.list-thumbnails').length + 1;
    var containerWidth = $(ul).outerWidth() * lengthUL;

    $('.container-list-thumbnails').css({
        width: containerWidth
    });


    // Buttons for next and previous
    $('.container-thumbnails').append('<div class="buttons"><a href="#" title="Ga naar de vorige" class="previous">Vorige</a><a href="#" title="Ga naar de volgende" class="next">Volgende</a></div>')
    var buttonPrevious = $('.container-thumbnails .previous');
    var buttonNext = $('.container-thumbnails .next');

    buttonNext.click(function(e) {
        e.preventDefault();

        if (this.ignoreButtons) {
            return;
        }

        var section = $('.container-list-thumbnails');
        var sectionIndex = section.index();

        var x = -300 * (sectionIndex + 1);

        console.log(x);

        this.ignoreButtons = true;

        $('.container-list-thumbnails').animate({
            left: x,
        }, function() {
            this.ignoreButtons = false;
        }.bind(this));
    }.bind(this));
});
​
  • 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-14T19:58:24+00:00Added an answer on June 14, 2026 at 7:58 pm

    I modified your slider to use one click handler for both buttons and to store sectionIndex in the parent element buttons using jQuery data('sectionIndex'). You will need to refine it a bit more so it can’t go below zero or beyond the length of thumb lists

    $('.buttons').data('sectionIndex', 0);
    var section = $('.container-list-thumbnails');
    $('.buttons a').click(function(e) {
        e.preventDefault();
        var isNext = $(this).is('.next');
        var $parent = $(this).parent();
    
        //if (this.ignoreButtons) {
            //return;
        //}
        var currIndex = $parent.data('sectionIndex');
    
        var sectionIndex = isNext ? currIndex + 1 : currIndex - 1;
    
        $parent.data('sectionIndex', sectionIndex);
    
        var x = -300 * sectionIndex;
    
        console.log(x);
    
        // this.ignoreButtons = true;
        $('.container-list-thumbnails').animate({
            left: x,
        }, function() {
            this.ignoreButtons = false;
        });
    });
    

    DEMO: http://jsfiddle.net/kwdMP/3/

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

Sidebar

Related Questions

I have a basic carousel at http://jsfiddle.net/v53Fm/ When you click the start button it
Ok, so I have a carousel that animates left and right. There is the
I have a carousel that I can change the location of with an integer
I'm trying to have a slide carousel for displaying different plots in my website.
I have a carousel that will contain images with the same width but different
I have a carousel implemented with jQuery. Sometimes I have other things on the
I have a carousel with images but the images appear to the left of
I have implemented the carousel on my webpage as follows <div class=container-fluid> <div id=myCarousel
I have an image carousel and shadowbox. I want the user to be able
I have a modal containing a carousel with 2 slides with login and signup

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.