Twitter bootstrap 使用鼠标滚轮旋转传送带更改
当我向上滚动时,我试图使旋转木马转到下一张图片,但当我向下滚动时,它会返回 我的代码:Twitter bootstrap 使用鼠标滚轮旋转传送带更改,twitter-bootstrap,mouse,carousel,Twitter Bootstrap,Mouse,Carousel,当我向上滚动时,我试图使旋转木马转到下一张图片,但当我向下滚动时,它会返回 我的代码: <script type="text/javascript"> $('#this-carousel-id').bind('mousewheel', function(e){$(this).carousel('next');}); </script> $('this carousel id').bind('mouseweel',function(e){$(this.carou
<script type="text/javascript">
$('#this-carousel-id').bind('mousewheel', function(e){$(this).carousel('next');});
</script>
$('this carousel id').bind('mouseweel',function(e){$(this.carousel('next');});
此代码适用于下一张图片的向上滚动,但不适用于返回。这不是最好的示例,但应该可以:
$('#this-carousel-id').bind('mousewheel', function(e)
{
if(event.wheelDelta>0) {
$(this).carousel('next');
}else if(event.wheelDelta<0){
$(this).carousel('prev');
}
}
);
$('this carousel id').bind('mouseweell',函数(e)
{
如果(事件轮增量>0){
$(this.carousel('next');
}如果(event.wheelDeltaI)正在尝试使用大多数逻辑执行类似的操作,但它对绑定事件逻辑完全没有响应,我就在这里