jquery循环使用淡入淡出div

jquery循环使用淡入淡出div,jquery,cycle,Jquery,Cycle,我需要在页面加载时显示所有DIV的none。在这一刻,他们都显示在一次,然后逐渐消失,旋转器的工作,因为它应该一旦它的圆柱通过第一次 (function($) { $.fn.testimonialrotator = function(o) { var defaults = { settings_slideshowTime : '5', settings_autoHeight : 'on' } o = $.extend(defaults

我需要在页面加载时显示所有DIV的none。在这一刻,他们都显示在一次,然后逐渐消失,旋转器的工作,因为它应该一旦它的圆柱通过第一次

(function($) {

$.fn.testimonialrotator = function(o) {

    var defaults = {
        settings_slideshowTime : '5',
        settings_autoHeight : 'on'
    }

    o = $.extend(defaults, o);
    this.each( function() {
        var cthis = jQuery(this);
        var cchildren = cthis.children();
        var currNr=0;
        var timebuf=0;
        var slideshowTime = parseInt(o.settings_slideshowTime);
        setInterval(tick, 1000);
        cthis.height(cchildren.eq(currNr).height());
        cchildren.eq(0).css('position', 'absolute');
        function tick(){
            timebuf++;
            if(timebuf>slideshowTime){
                timebuf=0;
                gotoNext();
            }
        }
        function gotoNext(){
            var arg=currNr+1;
            if(arg>cchildren.length-1){
            arg=0;
            }
            cchildren.eq(currNr).fadeOut('slow');
            cchildren.eq(arg).fadeIn('slow');
            if(o.settings_autoHeight=='on'){
                cthis.animate({'height' : cchildren.eq(arg).height()})
            }
            currNr=arg;
        }
        return this;
    })
}
})(jQuery)

最快的解决方案是将“无显示”应用为内联样式


或者,在脚本标记中,只需将display none应用于要隐藏的元素:加载时,而不是jquery ready中。

我想做这样的广告

$('my_divs').hide();
$('my_divs').first().show();

在您执行任何其他操作之前,请先输入脚本。

为演示提供足够的css,以便在jsfiddle.net中复制。可能会添加一些css修复