jQuery.holdReady()Method
Examples
HTML element right-click triggers event
<button id="first">Click to test popup</button>
<button id="second">Release hold</button>
<script>
$.holdReady(true)
$(document).ready(function(){
$("#first").click(function(){
alert("Pop up after the hold is released");
})
})
$("#second").click(function(){
$.holdReady(false);
})
</script>
Try it Yourself »
Definition and Usage
$The .holdReady() function is used to pause or resume the execution of the .ready() event.
Note:1. This method must be called early in the document, for example, immediately after loading the jQuery script in the head. If you call this method after the ready event has already fired, it will not work.
2. First call $.holdReady(true) [after calling, the ready event will be locked]. When you are ready to execute the ready event, call $.holdReady(false).
3. You can add multiple locks to the ready event, and each lock corresponds to one $.holdReady(false) [unlock] call. The ready event will be triggered when all locks are released and the page is also ready.
Syntax
$.holdReady( hold )
| Parameters | Description |
|---|---|
| hold | Boolean type. Indicates whether to pause or resume the requested ready event. |
Other Extensions
jQuery Event Methods