Skip to content Skip to sidebar Skip to footer

What Is The Function Of Google.maps.event.adddomlistener(window, 'load', Initialize);?

I was trying Google maps. I found this statement. google.maps.event.addDomListener(window, 'load', initialize); what is the function of that statement ?

Solution 1:

It adds a listener to the window object, which as soon as the load event is triggered (i.e. "the page has finished loading") executes the function initialize.

I.e. it delays the Google Map related script until the page has finished loading.

Solution 2:

@Dust function is initialize and it is called only after the <div> element is loaded. in maps.event..., I think event is element because essentially it contains the map-canvas information.

Post a Comment for "What Is The Function Of Google.maps.event.adddomlistener(window, 'load', Initialize);?"