0
나는 사용자가 어떤 링크를 클릭 할 때까지 기다리는 자바 스크립트 이벤트 리스너 함수를 가지고있다. 그러면로드 된 상자가 표시되어 다음 페이지로 넘어 간다.자바 스크립트 뒤로 버튼이 이벤트 리스너 호출을 표시합니까?
사용자가 뒤로 버튼을 클릭해도로드 상자가 계속 표시됩니까? 새로 고칠 필요없이 제거 할 수있는 방법이 있습니까?
function loading_show() {
document.getElementById("loading").removeAttribute("style");
}
// Function to add event listener to t
function load() {
var el = document.getElementsByTagName("a");
for (var i = 0; i < el.length; i++)
{
el[i].addEventListener("click", loading_show, false);
}
}
function init() {
// quit if this function has already been called
if (arguments.callee.done) return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
// do stuff
load();
};
var _timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) {
clearInterval(_timer);
init(); // call the onload handler
}
}, 10);
ps. 모바일 환경을 위해 개발 중이므로 jQuery를 사용하지 않으려 고합니다. 제발 제안하지 마세요.
내가으로 onUnload 작업을 얻을 수 있었다. 감사! – Steven