Jqueryには、ページが完全に読み込まれたときに$(document).ready()の後に発生する$(window).load()があります。私が理解しているところから$(document).ready()は、ページが完全に読み込まれる前でも起こります。 プレーンなjavascriptには$(window).load()Jqueryに対応するwindow.onloadがあります。 $(document).ready()に対応するjavascriptイベントは何ですか?before window.onload event
0
A
答えて
0
を答えはここにある:
bindReady: function() {
if (readyList) {
return;
}
readyList = jQuery.Callbacks("once memory");
// 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();
}
}
},
これは(window.onloadに対応
0
1
$(document).ready()
jQueryのsource codeから)、.ready() HTML DOMがブラウザウィンドウにロードされた後に実行します。
jQueryの.load()は、すでに開いているウィンドウのコンテキストにランダムなURLをロードするために使用できます。ajax呼び出しのように。
関連する問題
- 1. window.onload delay
- 2. Append window.onload
- 3. ";" before 'namespace'と ";" before 'using'
- 4. jQueryのwindow.onload
- 5. ASP.NETポストバックとwindow.onload
- 6. JavaScriptのwindow.onload対body.onload
- 7. window.onload = init();の違いは何ですか?およびwindow.onload = init;
- 8. windows.onload event
- 9. Before Databinder.Eval
- 10. javascript event inheritance
- 11. On-Session-Expire-Event?
- 12. change event on Meteor.js
- 13. WPF Touch Event Culling
- 14. Javascript:prevent keyUp event
- 15. CKeditor save event
- 16. jquery change event trigger
- 17. Jquery .on()submit event
- 18. java android create event
- 19. android activity "loaded event"
- 20. Vb.net process close event
- 21. javascript create class event
- 22. touch response event ios4
- 23. Spotify puzzle Best Before
- 24. @Beforeと@Transactional
- 25. hasClass before removeClass - jQuery
- 26. php date before 1970
- 27. StrictMode before 2.3
- 28. error:expected '} else before
- 29. error:expected ')' before 'n'
- 30. jQuery load-event after replaceWith
[$(document).ready equivalent with jQuery](http://stackoverflow.com/questions/799981/document-ready-equivalent-without-jquery) –
http://stackoverflow.com/を参照してください。質問/ 1283445/is-there-a-native-javascript-jquerys-document-readyの実装 – Crinsane
http://stackoverflow.com/questions/1206937/javascript-domready – naveen