【发布时间】:2012-11-16 18:16:09
【问题描述】:
我对 simple.carousel.js 进行了编辑,以便在悬停时停止轮播,但在鼠标离开时重新启动它时遇到问题。我添加到 simple.carousel.js 的代码是:
// hover stop
if(config.auto!=true)
$(this).mouseenter(function() {
config.auto=false;
}).mouseleave( function() {
config.auto=true;
});
您可以在此处查看完整的代码/示例以及我从上面添加的内容:http://jsfiddle.net/6r6sC/2/
我的 mouseleave 功能有问题吗?
不确定这是否会有所帮助,但我也尝试了以下方法,但这也不起作用:
// hover stop
if(config.auto!=true)
$(this).mouseenter(function() {
config.auto=false;
}).mouseleave( function() {
setTimeout(function() {
slide('next');
}, config.auto);
});
任何帮助将不胜感激,因为这让我很难过。
【问题讨论】:
-
使用第一个代码,auto 仅在页面加载时发挥作用。
标签: jquery hover carousel mouseenter mouseleave