Reputation: 125
How to hide left button after page load in Twitter bootstrap carousel?
http://twitter.github.com/bootstrap/javascript.html#carousel
My try(it works after first action, I need all 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();
}
});
Upvotes: 4
Views: 947
Reputation: 23537
Simply hide the left button after page load. Since it will always start at the first slide.
$('#myCarousel > .left.carousel-control').hide();
Or, manually trigger a slid
event after page load.
$('#myCarousel').on('slid', '', function () {
...
}).trigger('slid');
Upvotes: 1