4 ms·
Is there a way to achieve the same effect while keeping scripts in the <head>? (Not saying that's the best idea, just wondering.)
by spicyj 14y ago
Is there a way to achieve the same effect while keeping scripts in the <head>? (Not saying that's the best idea, just wondering.)
- crazygringo 14y agoYou could have your scripts just define functions, then call all those functions from the bottom of your <body>. Or, using jQuery, you could probably define a custom event on the <body>, that you trigger manually from the bottom of your <body>, and have your scripts in the <head> listen for that event. I've never actually tried this, though.
- carey 14y agoYUI can poll for elements to become available, with a few workarounds for browser bugs; see http://yuilibrary.com/yui/docs/event/domready.html http://yuilibrary.com/yui/docs/event/domready.html. I think you have to roll your own in jQuery.