【问题标题】:jQuery highlight on settimeoutjQuery 在 settimeout 上高亮显示
【发布时间】:2012-01-27 13:25:22
【问题描述】:

我有这个脚本:

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】:
    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);
            });
    }
    

    【讨论】:

      猜你喜欢
      • 2011-12-13
      • 2011-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-26
      • 2014-04-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多