myTD
myTD

Reputation: 1469

Carousel - Twitter BootStrap ; Hiding the Previous or Next button

I am trying to implement Carousel to my project.. Everything is working fine, except, based on the specs, I HAVE TO HIDE, the previous button, if i am on the first slide... and hide the next button, if i am on the last slide.. Is there a way to handle this?

Thank you

Upvotes: 2

Views: 2435

Answers (1)

user553180
user553180

Reputation: 626

Have you tried removing the carousel controls via removing "carousel-control left/right" classes.

<a class="carousel-control left" href="#myCarousel" data-slide="prev"> < </a>
<a class="carousel-control right" href="#myCarousel" data-slide="next"> > </a>
  • you can start with no "previous" control
  • catch the slide/slid event to determine when the first image has finish, then add back the "previous" control
  • continue catching slide/slid event, incrementing a counter along the way. when your counter is equal to your list of images, you can remove the "next" control

Upvotes: 3

Related Questions