我深深的疑惑...
大约一天前,我发布了一个关于使用附加到元素的 idletimer 的查询,以便在页面上特定元素的活动/不存在活动时触发或不触发事件,如下所示:
$("#testme" ).on( "idle.idleTimer", function(event, elem, obj){ $("#test").html("I am very idle");});
$( "#testme" ).on( "active.idleTimer", function(event, elem, obj, triggerevent){ $("#test").html("not idle");});
$( "#testme" ).idleTimer(3000);
似乎我已经完成了这项工作:您可以在http://jsfiddle.net/peterrr73/C3w7f/3中看到它运行良好。但是,当我将相同的代码粘贴到单独的文件中并将其放到网络上时,它会失败:您可以在http://www.sd-editions.com/CantApp/index4.html看到这个。更令人费解的是:您可以在http://www.sd-editions.com/CantApp/index2.html上看到,当附加到整个文档时,惰轮正在工作。
到底是怎么回事?当我去在线不运行的实例时没有报告错误。