jQuery在settimeout上突出显示

问题描述 投票:0回答:1

我有这个脚本:

function nudge(){
$("#info").animate({left:"+=5px"},40).animate({top:"+=5px"},40).animate({top:"-=10px"},40).animate({left:"-=10px"},40)
    .animate({top:"+=5px"},40).animate({left:"+=5px"},40)
    .animate({left:"+=5px"},40).animate({top:"+=5px"},40).animate({top:"-=10px"},40).animate({left:"-=10px"},40)
    .animate({top:"+=5px"},40).animate({left:"+=5px"},40)
    setTimeout(function(){
        $("#info").effect("highlight", {}, 3000);
    }, 1000);

}

我想在动画之后突出显示div,但现在我认为高光效果的设置是不正确的。

jquery settimeout highlight
1个回答
0
投票
function nudge(){
$("#info").animate({left:"+=5px"},40).animate({top:"+=5px"},40).animate({top:"-=10px"},40).animate({left:"-=10px"},40)
    .animate({top:"+=5px"},40).animate({left:"+=5px"},40)
    .animate({left:"+=5px"},40).animate({top:"+=5px"},40).animate({top:"-=10px"},40).animate({left:"-=10px"},40)
    .animate({top:"+=5px"},40).animate({left:"+=5px"},40)
        .delay(1000) // same as setTimeout 1000
        .animate({top:"+=5px"}, 0, function(){ // dummy animate for callback
            $("#info").effect("highlight", {}, 3000);
        });
}
© www.soinside.com 2019 - 2024. All rights reserved.