File tree Expand file tree Collapse file tree 1 file changed +31
-7
lines changed Expand file tree Collapse file tree 1 file changed +31
-7
lines changed Original file line number Diff line number Diff line change 1- // Load this script immediatley after jQuery, or as as early as possible.
2- // Then use .beforeReady instead of .ready(), e.g.
3- //
4- // $.beforeReady(function() {
5- // alert("Ere I am JH")
6- // });
7- //
1+ /*
2+ Load this script immediatley after jQuery, or as as early as possible.
3+ Then use .beforeReady to execute code before any .ready() functions, e.g.
4+
5+ $.beforeReady(function() {
6+ alert("Ere I am JH")
7+ });
8+
9+
10+ Here is an example html file showing how the .beforeReady() function executes before the .ready() function.
11+ <html>
12+ <head>
13+ <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
14+ <script src="jquery-before-ready.js"></script>
15+ </head>
16+ <body>
17+ <script>
18+ $(document).ready({
19+ alert("This function is declared first!")
20+ })
21+ </script>
22+ <script>
23+ $.beforeReady(function(){
24+ alert("This function is declared second but executes first!")
25+ })
26+ </script>
27+ </body>
28+ </html>
29+ */
30+
31+
832
933jQuery . beforeReadyPrivateArray = [ ]
1034jQuery . beforeReady = function ( handler ) {
You can’t perform that action at this time.
0 commit comments