Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>EDIT:</strong></p> <p><strong>NOTE: This answer is only applicable to jQuery v2 and below.</strong></p> <hr> <p><a href="http://api.jquery.com/ready/" rel="nofollow noreferrer">jQuery <code>.ready()</code> event</a>:</p> <blockquote> <p>The handler passed to <code>.ready()</code> is <strong>guaranteed</strong> to be executed <strong>after the DOM is ready</strong>, so this is usually the <em>best place to attach all other event handlers</em> and run other jQuery code.</p> </blockquote> <p><a href="http://api.jquery.com/load-event/" rel="nofollow noreferrer">jQuery <code>.load()</code> event <em>method</em></a>:</p> <blockquote> <p>The <code>load</code> event is sent to an element <strong>when it and all sub-elements have been completely loaded</strong>. This event can be sent to any element associated with a URL: images, scripts, frames, iframes, and the window object.</p> </blockquote> <p>Based on the jQuery documentation above, I've seen nothing that would indicate any issues with the following:</p> <pre><code>$(document).ready(function () { // will fire IMMEDIATELY after the DOM is constructed $(window).load(function() { // will only fire AFTER all pages assets have loaded }) }); </code></pre> <p>Placing a <code>.load</code> inside of a <code>ready</code> simply guarantees that the DOM is ready whenever the <code>load</code> is fired.</p> <p>One may wish to place <strong>all</strong> jQuery code within a single DOM ready handler, and yet still may have a sub-set of jQuery code that requires all images be loaded first. This arrangement guarantees that all code be triggered once on DOM ready and the rest will be triggered subsequently whenever the page assets have finished loading.</p> <p>This may ultimately be more of an issue of personal preference, however the OP was clearly asking if this arrangement would cause problems. This has not proven to be true.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload