My landing page contains a big google maps portion, which slows down the loading time. I am trying to do the following:
- Load the static elements first so the page loads fast initially.
- Display a loading notification in the map placeholder so that the user knows that the map is coming up
- Load and display the map
I have done this:
$(document).ready(function() {
map_initialize();
}
The map_initialize() function loads the map into its container div. However, this still will not display the static elements fist. The page will wait until the map_initialize() is finished, then load the static elements at the same time as the map.
The
window.onloadevent will wait for the images, and any other resource on the document, to load before it gets fired:You may also want to check out the following Stack Overflow post for further reading:
Therefore all you need to do is to set the
window.onloadevent handler as follows: