スライドショーギャラリーに次のスクリプトを使用しています.10秒ごとに数枚の写真を次々と回転させる必要があります.
Firefox をバージョン 13.0.1 にアップグレードするまでは (FF で) 機能していました。
現時点では、しばらく実行すると、めちゃくちゃになります-タイマーを無視し、2枚の写真だけを回転させ、他の3枚を完全に無視します.
この問題を修正してスクリプトをより堅牢にするにはどうすればよいですか?
ありがとうございました!!!
function slideSwitch() {
var $active = $('#slideshow div.active');
if ( $active.length == 0 ) $active = $('#slideshow div:last');
// pull the divs in the order they appear in the markup
var $next = $active.next().length ? $active.next() : $('#slideshow div:first');
$active.addClass('last-active');
$next.css({opacity: 0.0})
.addClass('active')
.animate({opacity: 1.0}, 3000, function() {
$active.removeClass('active last-active');
});
}
$(function() {
var timer = setInterval( "slideSwitch()", 10000 );
$('#slideshow').hover(
function () {
clearInterval(timer);
},
function () {
timer = setInterval("slideSwitch()", 10000);
}
);
});
次の方法でhtmlでjqueryを呼び出します。
<div id="slideshow">
<div class="active">
<img src="/images/slideImages/1.jpg" alt="xxx 1" title = "xx 1"/>
</div>
<div>
<img src="/images/slideImages/2.jpg" alt="xxx 2" title="xx 2" />
</div>
<div>
<img src="/images/slideImages/3.jpg" alt="xxx 3" title="xx 3" />
</div>
<div>
<img src="/images/slideImages/4.jpg" alt="xx 4" title="xx 4" />
</div>
<div>
<img src="/images/slideImages/5.jpg" alt="xxx 5" title="xx 5" />
</div>
</div>