我正在使用idle-timer.js,它可以正常工作,但是不能使用我想要的功能:我只有一个html页面,其中包含三个部分:#front,#history和#items。每个部分都是全屏显示,我通过在它们之间进行切换来“显示:无;” 或“显示:阻止;”。
我只想在#history或#items空闲时才重新加载页面,并且在#front空闲时我不希望页面重新加载。
我尝试了不同的解决方案,例如:
$.idleTimer(120000);
$(document).bind("idle.idleTimer", function() {
if ($(‘#items’).css(‘display’) === ‘block’ || (‘#history’).css(‘display’) === ‘block’)) {
location.reload();
}
});
我怎样才能做到这一点?
您使用了错误的引号(反引号),并且$
在#history
选择器中缺少该字符:
if ($('#items').is(':visible') || $('#history').is(':visible')) {
location.reload();
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句