I\'ve attached multiple functions in multiple files to $(document).ready and would like to attach a single function to happen before them as either the first that $(document).re
This would be a time where I would trigger a custom event that all of your other files would bind
to, you would only have one ready
handler, which would do stuff, then trigger the custom event.
So, somewhere else in your code, instead of using $(document).ready
, you would use
$(window).bind('setup', function() {
//code here...
});
And/or
$(window).bind('loaded', function() {
//some other code here...
});
And in your one and only ready
handler, you'd do something like this:
$(document).ready(function() {
$(window).trigger('setup');
$(window).trigger('loaded'):
});