Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/447.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无需等待延迟即可启动动画_Javascript_Jquery - Fatal编程技术网

Javascript 无需等待延迟即可启动动画

Javascript 无需等待延迟即可启动动画,javascript,jquery,Javascript,Jquery,我有这个动画,但没有立即启动幻灯片1,功能在“auto_animate_delay”(自动动画延迟)8000后启动,因此在等待第二个幻灯片动画或将鼠标移到过渡上后加载开始 我必须遵循的路径是什么,以便动画从第一张幻灯片开始就可以正常工作,并且不会出现延迟 $(document).ready(function(){ var animation = { 'auto_animate': true,

我有这个动画,但没有立即启动幻灯片1,功能在“auto_animate_delay”(自动动画延迟)8000后启动,因此在等待第二个幻灯片动画或将鼠标移到过渡上后加载开始

我必须遵循的路径是什么,以便动画从第一张幻灯片开始就可以正常工作,并且不会出现延迟

        $(document).ready(function(){

            var animation = {
                'auto_animate': true,
                'auto_animate_delay': 8000,
                'auto_animate_id': '',
                'caption_speed': 'fast',
                'panel_speed': 1000,
                'panel_easing': 'easeInOutCubic'
            }

            $(".item-list").css({"position":"absolute","top":"0","left":"0","float":"left","width": "100%"});

            var i = 1;
            $('li.item-slide').each(function(key, value) {
                $(value).attr('id', 'item-slide-'+i);
                i++;
            });

            $('.slide_caption').hide();
            $('#item-slide-1 > .slide_caption').show();
            $('#item-slide-1').addClass('active');
            //$('.item-slide').not('.active').children('.slide_image_slice').show();


        $('.item-slide')
            .bind('open', function(){
                if(! $(this).hasClass('open')){
                    $(this).next().trigger('open');
                    $(this).addClass('open');
                    $(this).animate({right: "-=769px"}, animation.panel_speed, animation.panel_easing, function(){display_slices();});
                }
                else{
                    $(this).prev().trigger('close');
                }
                $(this).siblings().removeClass('active');
                $(this).addClass('active');
                setTimeout(function(){hide_slices()},1);


                display_caption();
            })
            .bind('close', function(){
                if($(this).hasClass('open')){
                    $(this).removeClass('open');
                    $(this).animate({right: "+=769px"}, animation.panel_speed, animation.panel_easing, function(){display_slices();});
                    $(this).prev().trigger('close');
                }
            });

        $('.item-slide')
            .hoverIntent(
            function() {
                animation.auto_animate = false;
                trigger_accordion($(this));
            },
            function() {
                animation.auto_animate = true; // auto en true para volver a activar
                clearInterval(animation.auto_animate_id);
                animation.auto_animate_id = setInterval(slideshow_animate, animation.auto_animate_delay);

            }
        )
            .click(function() {
                trigger_accordion($(this));
            });


        animation.auto_animate_id = setInterval(slideshow_animate, animation.auto_animate_delay);


function trigger_accordion(itemSlide) {
    if(!(itemSlide.is(':animated'))) {
        itemSlide.trigger('open');
    }
}

function display_caption() {
    $('.slide_caption').each(function() {
        if(!($(this).parent().hasClass('active'))) {
            $(this).fadeOut('fast', function() {
                $('.item-slide.active > .slide_caption').fadeIn(animation.caption_speed);
            });
        }
    });
}

function hide_slices() {
    $('.slide_image_slice').each(function() {
        if($(this).parent().hasClass('active')) {
            $(this).fadeOut('fast');
        }
    });
}

function display_slices() {
    $('.slide_image_slice').each(function() {
        if(!$(this).parent().hasClass('active') && !$(this).is(":visible")) {
            $(this).fadeIn('fast');
        }
    });
}

function slideshow_animate() {
    if(!animation.auto_animate) return;

    var next_slide = $('.item-slide.active').next();
    if(!next_slide.length) {
        next_slide = $('#item-slide-1');
    }

    next_slide.click();

}

        });

这里是在黑暗中拍摄的,但是您是否尝试过将
'auto\u animate\u delay':8000,
更改为
'auto\u animate\u delay':0,
?@j08691如下:
animation.auto\u animate\u id=setInterval(幻灯片放映,动画,动画,auto\u animate\u animate\u delay)我不想说“自动设置动画延迟”:0,该选项不起作用,因为所有动画都将在没有间隔的情况下保留,我只需要删除初始幻灯片中的第一张幻灯片,单击即可,幻灯片将在不等待延迟的情况下处于活动状态