我怎么知道Bootstrap旋转木马滑梯的方向?有什么事吗?

sdv*_*ksv 2 jquery slide direction carousel twitter-bootstrap-3

我需要在bootstrap carousel slide上将事件绑定到右边.我有这个代码:

$('#carousel-showcase').bind('slid', function () {
    $("#wrap").animate({
        backgroundPositionX: '+=50%'
    },0);
});
Run Code Online (Sandbox Code Playgroud)

但它的工作方向无关紧要.有帮助吗?

rin*_*aff 5

如果您使用的是Bootstrap 3,则可以从幻灯片事件中获取方向:

$('#carousel-showcase').bind('slide.bs.carousel', function (event) {
    console.log(event.direction);
});
Run Code Online (Sandbox Code Playgroud)

请记住,这仅适用于幻灯片事件,而不是滑动.