Created
March 15, 2012 16:43
-
-
Save Iristyle/2045205 to your computer and use it in GitHub Desktop.
Standard document onReady script queue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- concepts from http://samsaffron.com/archive/2012/02/17/stop-paying-your-jquery-tax --> | |
<!-- for head --> | |
<script type='text/javascript'> | |
window.$ = (function() { | |
var q = [], f = function (cb) { | |
q.push(cb); | |
}; | |
f.attachReady = function ($) { | |
$(function () { | |
$.each(q, function(i, f) { | |
f(); | |
}); | |
q.length = 0; // clear it, just in case | |
}); | |
return $; | |
} | |
return f; | |
})(); | |
</script> | |
<!-- at end of page --> | |
<script type="text/javascript"> | |
$.noConflict(); | |
$ = $.attachReady(jQuery); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment