Beluga
13 Dec 2010, 09:09 AM
http://headjs.com/?2.0#theory
If you have a lot of scripts to load you will love this.
From one of the guys behind jQuery Tools and Flowplayer.
Note this though:
With Head JS your page can be ready before your scripts. You need to prepare for that
* The "DOM ready" event such as $(document).ready() is already fired when the scripts arrive. If the loaded scripts depend on that event make sure your library can handle this. jQuery 1.4+ works.
* If your scripts modify the page you can see a "flash of unbehaviored content" effect (FUBC): a quick glimpse of unmodified HTML before the loaded scripts act on it. You can avoid this by initially hiding the modifiable elements before your scripts make them visible and do their job.
If you have a lot of scripts to load you will love this.
From one of the guys behind jQuery Tools and Flowplayer.
Note this though:
With Head JS your page can be ready before your scripts. You need to prepare for that
* The "DOM ready" event such as $(document).ready() is already fired when the scripts arrive. If the loaded scripts depend on that event make sure your library can handle this. jQuery 1.4+ works.
* If your scripts modify the page you can see a "flash of unbehaviored content" effect (FUBC): a quick glimpse of unmodified HTML before the loaded scripts act on it. You can avoid this by initially hiding the modifiable elements before your scripts make them visible and do their job.