Hi,
@Michal :
Putting scripts at bottom speed up your page loading, i suggest you to
read this : http://developer.yahoo.com/performance/rules.html#js_bottom
@Wanlee :
I suggest you to continue to use domready anyway.
Maye be you can post a page to show your code?
Regards.
Michal a écrit :
Are you saying that 'domready' fires too early, before the html is
ready? This sounds strange. It could be:
- A bug with domready. I suspect this is unlikely as this is so
heavily used and tested. But if you can construct a testcase, post a
bug in lighthouse.
- A bug with your code somewhere: are you sure everything that
accesses the DOM is inside a domready listener?
I have seen advice somewhere on the internet that says you should put
Javascript at the bottom of the html, but it's never quite sat well
with me, it seems a bit hackish, but I don't quite know why. I always
put it in the head, with a domready. Maybe others have other
suggestions...
There is the 'load' event, that waits for all images to load as well,
you could try that, but I suspect that there is something else afoot.
Can you post a link to the page you're talking about?
Michal.
On Jan 5, 8:32 am, wanlee <[email protected]> wrote:
I'm writing a few functions for sliders and json requests and it
appears that the javascript is loading faster than the html causing
the slider to not initialize. it doesn't happen on every page load but
more so in safari.
moving my script tags to the bottom of the html solves the problem. is
this normal or could there be something wrong with my code? should i
use something other than 'domready'?
take swing!
--
Nicolas Trani - web engineer
Weelya - Improve the web
32 rue du faubourg boutonnet
34090 Montpellier
Tel/Fax : 04 67 169 778
http://www.weelya.com
Notre agence sera fermée du 12 au 16 janvier 2009