How to hide the left button after loading the page in the twitter bootstrap carousel?

How to hide the left button after loading the page in the twitter bootstrap carousel?

http://twitter.github.com/bootstrap/javascript.html#carousel

My attempt (works after the first action, I need it all the time):

$('#myCarousel').on('slid', '', function() { var $this = $(this); $this.children('.carousel-control').show(); if($('.carousel-inner .item:first').hasClass('active')) { $this.children('.left.carousel-control').hide(); } else if($('.carousel-inner .item:last').hasClass('active')) { $this.children('.right.carousel-control').hide(); } }); 
+4
source share
1 answer

Just hide the left button after loading the page. Since it will always start from the first slide.

 $('#myCarousel > .left.carousel-control').hide(); 

Or manually slid event after the page loads.

 $('#myCarousel').on('slid', '', function () { ... }).trigger('slid'); 
+1
source

All Articles