【发布时间】:2013-01-04 03:45:42
【问题描述】:
这个 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)
【问题讨论】:
-
timeoutTrigger中的前 2 行是否导致异常?控制台中是否有任何错误消息?代码似乎正确。 -
+1 宅男,这似乎有效jsfiddle.net/sASvm
-
this不是一个不应该用作变量的关键字吗? -
@MrXenotype :变量是
$this,而不是this -
在 Chrome 中,开发者工具是你的朋友——F12 或 CTRL+Shift+I。检查控制台是否有错误消息。
标签: javascript google-chrome settimeout