1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
<!DOCTYPE html>
<html lang='en'><head><meta http-equiv='content-type' content='text/html; charset=UTF-8' /></head><body>
<div class="entry-content">
<div class="entry-title roundTop">
<h1 class="jq-clearfix">jQuery.holdReady()</h1>
<div class="entry-meta jq-clearfix">
Categories:
<span class="category"><a href="http://api.jquery.com/category/core/" title="View all posts in Core">Core</a></span>
</div>
</div>
<div id="jQuery-holdReady1" class="entry method">
<h2 class="jq-clearfix roundTop section-title">
<span class="name">jQuery.holdReady( hold )</span> <span class="returns">Returns: <a class="return" href="http://api.jquery.com/Types/#undefined">undefined</a></span>
</h2>
<div class="jq-box roundBottom entry-details">
<p class="desc"><strong>Description: </strong>Holds or releases the execution of jQuery's ready event.</p>
<ul class="signatures"><li class="signature" id="jQuery-holdReady-hold">
<h4 class="name">
<span class="versionAdded">version added: <a href="/category/version/1.6/">1.6</a></span>jQuery.holdReady( hold )</h4>
<p class="arguement"><strong>hold</strong>Indicates whether the ready hold is being requested or released</p>
</li></ul>
<div class="longdesc">
<p>The <code>$.holdReady()</code> method allows the caller to delay jQuery's ready event. This <em>advanced feature</em> would typically be used by dynamic script loaders that want to load additional JavaScript such as jQuery plugins before allowing the ready event to occur, even though the DOM may be ready. This method must be called early in the document, such as in the <code><head></code> immediately after the jQuery script tag. Calling this method after the ready event has already fired will have no effect. </p>
<p>To delay the ready event, first call <code>$.holdReady(true)</code>. When the ready event should be released to execute, call <code>$.holdReady(false)</code>. Note that multiple holds can be put on the ready event, one for each <code>$.holdReady(true)</code> call. The ready event will not actually fire until all holds have been released with a corresponding number of <code>$.holdReady(false)</code> calls <em>and</em> the normal document ready conditions are met. (See <a href="http://api.jquery.com/ready/"><code>ready</code></a> for more information.)</p>
</div>
<h3>Example:</h3>
<div class="entry-examples" id="entry-examples"><div id="example-0">
<h4><span class="desc">Delay the ready event until a custom plugin has loaded.</span></h4>
<pre class="prettyprint"><code class="example">
$.holdReady(true);
$.getScript("myplugin.js", function() {
$.holdReady(false);
});
</code></pre>
</div></div>
</div>
</div>
</div>
</body></html>
|