回答
也许这可以帮助您
function loopNext(){
$('#sliderWrapper').stop().animate({scrollLeft:'+=20'}, 'fast', 'linear', loopNext);
}
function loopPrev(){
$('#sliderWrapper').stop().animate({scrollLeft:'-=20'}, 'fast', 'linear', loopPrev);
}
function stop(){
$('#sliderWrapper').stop();
}
$('#next').hover(function() {
loopNext();
},function() {
stop();
});
$('#prev').hover(function() {
loopPrev();
},function() {
stop();
});
我会建议使用鼠标悬停事件。当鼠标开始动画时,鼠标停止动画时。
这应该是一个评论。 – 2014-09-05 14:52:10
即使我没有实现鼠标移动,我仍然没有得到想要的效果,而只是将它移动超过200px一次。见[这里](http://jsfiddle.net/linddss/eoyd9tnq/)。 – linddss 2014-09-05 14:54:22
试试这个jsFiddle
这会,上next
悬停,开始往容纳div
的width
动画。当你退出时,它会停止。在prev
悬停将开始动画到0
,当你将鼠标移出它将停止。
$('#next').hover(function() {
$('#sliderWrapper').animate({scrollLeft: $(this).siblings("#sliderWrapper").width()}, 5000);
}, function() {
$('#sliderWrapper').stop();
});
$('#prev').hover(function() {
$('#sliderWrapper').animate({scrollLeft: 0 }, 5000);
}, function() {
$('#sliderWrapper').stop();
});
也可以,谢谢! – linddss 2014-09-05 15:00:47
- 1. Jquery滑块左右滑动问题
- 2. UIViewController忽略左/右滑动移动
- 3. 滑动滑块绑定悬停事件
- 4. 如何制作在iOS中自动左右移动的滑块?
- 5. 如何停止滑块动画悬停?
- 6. jQuery滑块停在悬停
- 7. jquery暂停悬停滑块
- 8. jquery滑块暂停悬停
- 9. 如何制作左右活动滑块?
- 10. 制作滚动滑块从右到左
- 11. Matlab滑块 - 显示左右箭头并每1秒移动一次滑块
- 12. CSS滑块左移
- 13. Android左右滑动?
- 14. 左右滑动UIView
- 15. ECSlidingViewController左右滑动
- 16. 将滑块中的图像左右移动的问题
- 17. 当鼠标移动时,jQuery悬停滑块再次启动
- 18. 移动/滑动页面左/右用户用手指触摸设备向左滑动/右移
- 19. Javascript动作将滑块滑动到左侧或右侧
- 20. 滑动活动从右到左像菜单滑块android
- 21. CSS悬停/滑块变化
- 22. Eclipse按键可以将文本块左右滑动
- 23. 左右滑动的Android滑动菜单
- 24. jQuery:向左滑动并向右滑动
- 25. 左右移动UIButton
- 26. jQuery滑块句柄左移
- 27. android左右滑动gridView
- 28. 滑动左/右的事件
- 29. 从左到右滑动Divider
- 30. 向右或向左滑动
非常感谢你!这是工作[小提琴](http://jsfiddle.net/linddss/88hv1hvs/)! – linddss 2014-09-05 14:59:30
@adrxlm:我的回答错了,我首先以为你的回答和我回答的一样。但你已经很好地回答了它 – 2014-09-05 15:14:06