setTimeout似乎在Chrome中不起作用

mas*_*ean 9 javascript google-chrome settimeout

这个setTimeout在Firefox中完美运行,但在Chrome中,函数timeoutTrigger中没有任何内容发生,包括警报.有任何想法吗?

var $this = $('.active-more');

function timeoutTrigger() {
    $this.closest(".container").nextAll(".container:first").find(".description:first").removeClass('hide');
    $this.closest(".container").nextAll(".container:first").find(".back:first").find("img.portfolio").remove();
    alert("is this thing on?");
}

setTimeout(function(){timeoutTrigger()},400)
Run Code Online (Sandbox Code Playgroud)

Shr*_*pta 6

将您的setTimeout语句切换为以下内容:setTimeout(timeoutTrigger,400); 您编写的语句适用于您正在调用的函数具有参数的情况.另外,你错过了一个分号.

  • 虽然好的风格建议,但这并没有真正解决问题. (10认同)
  • 天啊.这是分号.Jeeze.非常感谢! (2认同)
  • Bagavatu指出`setTimeout(function(){timeoutTrigger()},400)之后缺少分号. (2认同)