Reputation: 9668
I need to bind an event upon bootstrap carousel slide to right only. I've got this code:
$('#carousel-showcase').bind('slid', function () {
$("#wrap").animate({
backgroundPositionX: '+=50%'
},0);
});
But it works doesn't matter the direction. Any help?
Upvotes: 2
Views: 1966
Reputation: 2325
If you are using Bootstrap 3, you can get the direction from the slide event:
$('#carousel-showcase').bind('slide.bs.carousel', function (event) {
console.log(event.direction);
});
Keep in mind that this is only for the slide event, not slid.
Upvotes: 6