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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:15:53+00:00 2026-06-12T11:15:53+00:00

I want to make simple jQuery fading carousel with simple pagination. Everything works well.

  • 0

I want to make simple jQuery fading carousel with simple pagination.
Everything works well. But when I click NEXT button the Carousel returns to the first item every time.

How to fix this issue?

The Fiddle

In case the fiddle goes stale, see my HTML:

<body>    
    <ul id="carousel">
        <li class="is-showing" ><img src="http://aarontennyson.com/tutorials/demos/slide_show_fade/images/slide1.jpg" width="960" height="375" alt="image 1" /></li>
        <li class="is-showing" ><img src="http://aarontennyson.com/tutorials/demos/slide_show_fade/images/slide2.jpg" width="960" height="375" alt="image 2"  /><li>
            <li class="is-showing" ><img src="http://aarontennyson.com/tutorials/demos/slide_show_fade/images/slide3.jpg" width="960" height="375" alt="image 3"  /></li>
            <li class="is-showing" ><img src="http://aarontennyson.com/tutorials/demos/slide_show_fade/images/slide4.jpg" width="960" height="375" alt="image 4"  /></li>
            <li class="is-showing" ><img src="http://aarontennyson.com/tutorials/demos/slide_show_fade/images/slide5.jpg" width="960" height="375" alt="image 5"  /></li>
    </ul>
<span class="prev">prev</span>
<span class="next">next</span>
</body>

and script:

$(document).ready(function() {
    slideShow();
});

function slideShow() {
    var showing = $('#carousel .is-showing');
    var next = showing.next().length ? showing.next() : showing.parent().children(':first');

    showing.fadeOut(800, function() {
        next.fadeIn(800).addClass('is-showing');
    }).removeClass('is-showing');
    setTimeout(slideShow, 5000);

    $(".next").click(function() {
        showing.fadeOut(800, function() {
            next.fadeIn(800).addClass('is-showing');
        }).removeClass('is-showing');
    })
}​
  • 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-12T11:15:55+00:00Added an answer on June 12, 2026 at 11:15 am

    You’ll need to rewrite some code to figure that out.
    Split repeating actions in functions.

    Fixed example

    New Script:

    $(document).ready(function() {
        slideShow();
    });
    
    function slideShow() {
        var slides = $('#carousel li');
        var previousIndex = 0,
            currentIndex = 0,
            timer;
        slides.hide().removeClass('is-showing').eq(currentIndex).show().addClass('is-showing');
    
        function nextSlide() {
            previousIndex = currentIndex;
            if (currentIndex < slides.length - 1) currentIndex++;
            else currentIndex = 0;
            switchSlides();
        }
    
        function switchSlides() {
            slides.eq(previousIndex).removeClass('is-showing').fadeOut(300, function() {
                slides.eq(currentIndex).addClass('is-showing').fadeIn(300);
                autoRotate();
            });
        }
    
        function autoRotate() {
            clearTimeout(timer);
            timer = setTimeout(nextSlide, 5000);
        }
    
        autoRotate();
        $(".next").click(nextSlide);
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to make a simple jquery slider, i dont know jquery very well,
i want make a simple delete using Ajax but this dont works, i wantmake
I am trying to make a simple user click action recorder in jquery but
i am begginer to jquery and have a simple problem.. I want to make
I want to make a simple table that contains a custom button in a
I am making a simple game with jquery and i want to make a
I want to make a simple accordion menu with only one menu button closed
I want to use jQuery to make a simple call to my MVC controller.
I want to make a hover effect using jquery. Opacity and a simple zoom
I want to use JavaScript to make a simple http get. I used jQuery

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.