I have a beautiful background image on a website which unfortunately takes a while to load. The rest of my page is driven by a function that is called when the body loads like so:
<body onLoad="initialise()">
...
Because of this, my browser is waiting for the background to fully load before calling initialise(). How can i either call initialise() before the page fully loads or at least before the background image does.
Thank you for your time :)
Just add this right before the </body> tag:
<script type="text/javascript">initialise();</script>
If you need to wait til the page is ready, try using jQuery's ready event instead:
<script type='text/javascript'>jQuery(document).ready(initialise)</script>
This will run before images are loaded, but will wait for all HTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With