Jon Raasch jQuery Slideshow Script 在 Chrome 中无法为我工作

Jon Raasch jQuery Slideshow Script failed to work for me in Chrome?

本文关键字:工作 Chrome jQuery Raasch Slideshow Script Jon      更新时间:2023-09-26
/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/
function slideSwitch() {
    var $active = $('#slideshow IMG.active');
    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');
    // uncomment the 3 lines below to pull the images in random order
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );

    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 500, function() {
            $active.removeClass('active last-active');
        });
}
$(function() {
    setInterval( "slideSwitch()", 2500 );
});

我需要滑动所有 5 张图像。问题是在第二个图像上停止,并在刷新后继续正常工作。如果您粘贴 URL(或通过在浏览器中按),这将仅显示 2 张图像。

如果我将动画和设置间隔都更改为 1000,则动画效果不佳。

有人可以帮我如何完成这项工作吗?


看起来像一个错误,因为如果我进行页面刷新,它就可以工作,但在我打开页面时不会。 以下是错误 https://stackoverflow.com/questions/11872278/is-this-a-bug-in-google-chrome-slider-not-worked 的详细信息

不确定是你想要的,但改变了这个:

$(function() {
    setInterval( "slideSwitch()", 2500 );
});​

setInterval(slideSwitch, 2500);

附言
适用于 Chrome v. 21.0.1180.60 m