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

  • Home
  • SEARCH
  • 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 8515843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:15:28+00:00 2026-06-11T05:15:28+00:00

How can you tell whether the twitter bootstrap carousel is going fwd or back?

  • 0

How can you tell whether the twitter bootstrap carousel is going fwd or back? I want to be able to do something like:

$('#myCarouse').on('slide', function(e) {
  if (fwd?) {do something}
});
  • 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-11T05:15:29+00:00Added an answer on June 11, 2026 at 5:15 am

    The only special info the Carousel plugin appends to the slide event object is a relatedTarget property which contains the element that is going to be switched to. That can be used to manually calculate where you are about to move in the carousel.

    Something along the lines of:

    $('#myCarousel').on('slide', function (e) {
      var $active = $(this).find('.item.active')
        , children = $active.parent().children()
        , activePos = children.index($active)
        , nextPos = children.index(e.relatedTarget)
        , diff = nextPos - activePos;
    
        if (diff === 1 || diff < -1 || diff === 0) {
            console.log('next');
        } else {
            console.log('prev');
        }
    });​
    

    That diff === 0 is to handle the strange behavior I saw when on the last slide and moving to the first one. For some reason, activePos and nextPos come out equal. I can’t make sense of it; it just is.

    Here’s a demo:

    JSFiddle

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

Sidebar

Related Questions

I think I read something about a function appengine has that can tell whether
Is there a way I can tell whether stderr is outputting to a file
How can I tell whether an algorithm is stable or not?.. Also, how does
How can you tell whether the device is oriented vertically (portrait) or horizontally (landscape)?
Can anyone tell me whether Helvetica is a browser base font? If so, it
Can someone tell me whether MSMQ (using transactions) supports competing consumers? Basically, I have
Can someone tell me whether an open source project with GPL 2.0 license hosted
How can I tell whether a circle tangents the outer rectangle or is located
How can I tell whether a remote message queue exists ? The documentation states
How can I tell whether two triangles intersect in 2D Euclidean space? (i.e. classic

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.