그냥 롤 자신 :) 여기에 jQuery를 당신이 필요로하는 것을 가지고, 준비 이벤트를 위해 사용하는 코드는, 그것은 무료 (단에서 나온 코드에서 언급 할)의
bindReady: function() {
if (readyList) {
return;
}
readyList = jQuery._Deferred();
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if (document.readyState === "complete") {
// Handle it asynchronously to allow scripts the opportunity to delay ready
return setTimeout(jQuery.ready, 1);
}
// Mozilla, Opera and webkit nightlies currently support this event
if (document.addEventListener) {
// Use the handy event callback
document.addEventListener("DOMContentLoaded", DOMContentLoaded, false);
// A fallback to window.onload, that will always work
window.addEventListener("load", jQuery.ready, false);
// If IE event model is used
} else if (document.attachEvent) {
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent("onreadystatechange", DOMContentLoaded);
// A fallback to window.onload, that will always work
window.attachEvent("onload", jQuery.ready);
// If IE and not a frame
// continually check to see if the document is ready
var toplevel = false;
try {
toplevel = window.frameElement == null;
} catch(e) {}
if (document.documentElement.doScroll && toplevel) {
doScrollCheck();
}
}
},
그럼 당신은 두 질문 모두에 완벽하게 답변했습니다. 나는 그것을 받아들입니까? –
글쎄, 너에게 달렸어. 나는 당신의 주요한 질문에 대답했습니다. 당신을 가장 도운 것으로 받아들이십시오. –