我想在两个函数之间添加wait()或延迟。

function(imageID)
    {
        //alert("i main slider called ");

        if(en==1)
        {
            var selected=$('#' + sel);
            $(selected).animate({"left": "+=30px","opacity": "0.99"},"slow");
            $(selected).animate({"height":"354px","width":"295px"},30);
            $(selected).css("-webkit-transform-style","preserve-3d");
            $(selected).css("-webkit-transition","all 1.0s linear");
            $(selected).css("transform-style","preserve-3d");
            $(selected).css("transition","all 1.0s linear");
            $(selected).css("-webkit-transform","rotateY(0deg)");
            $(selected).css("transform","rotateY(0deg)");
            en=0;
        }

        if(my.circular)
        {
            /* Trigger left jumppoint */
            if(imageID+1 === my.imageFocusMax)
            {
                /* Set jump target to the same cloned image on the right */
                clonedImageID = my.max - my.imageFocusMax;
                jumpTarget = -clonedImageID * my.xStep;

                /* Set the imageID to the last image */
                imageID = clonedImageID-1 ;
            }


在我的函数中,我想在if语句后添加一个delar。我怎样才能做到这一点?我尝试添加delay(),但无法正常工作。我应该使用什么?

最佳答案

使用setTimeout功能。这样,您可以告诉浏览器在做某事之前先等待。

关于jquery - 在两个if条件之间增加延迟,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16441245/

10-12 01:45