【发布时间】:2014-05-04 05:00:27
【问题描述】:
这是我的第一篇文章。我的代码适用于 chrome 和 safari,但幻灯片不会在 Firefox 中停止。我想展示此代码的实时版本以使其更容易,但我在本地工作。我想知道是不是因为我用悬停而不是鼠标悬停和鼠标离开来写它,但我不知道如何正确地写出来。这段代码甚至可能有错误,但浏览器没有检测到它。
HTML:
<div class="fadelinks">
<a href="#"> <img src=""/> </a>
<a href="#"> <img src=""/> </a>
<a href="#"> <img src=""/> </a>
<a href="#"> <img src=""/> </a>
</div>
jQuery:
jQuery(document).ready(function($) {
$(".fadelinks").each(function(){
var $this = this;
$($this).hover(function(){
$('> :gt(0)', $this).hide();
timer = setInterval(function(){$('> :first- child',$this).fadeOut()
.next().fadeIn().end().appendTo($this);}, 1500);
}, function() {
clearInterval(timer);
});
});
});
【问题讨论】:
标签: javascript jquery hover slideshow mouseenter