Tagged: event listener, Google map API
-
AuthorPosts
-
November 29, 2018 at 5:38 pm #1039062
Is there a recommended method of tying into the aviaOnGoogleMapsLoaded callback that is triggered once the Google Map API has finished loading?
November 30, 2018 at 3:23 pm #1039336Hey Switzer,
Well, you need to write a custom script that will listen to that event and add a function to handle it.
If you need further assistance please let us know.
Best regards,
VictoriaDecember 3, 2018 at 11:06 am #1040212exactly, so which type of event would this be?
Maybe a little example of how the event listener should be constructed?Would this be the recommended way:
(function($){ $('body').on('av-google-maps-api-loaded', my_callback() ); function my_callback(){ console.log('hey dude'); } })( jQuery );or maybe better to use the avia-google-maps-api-script-loaded event?:
$('body').on('avia-google-maps-api-script-loaded', my_second_callback() ); function my_second_callback(){ console.log('phone is ringing, dude'); }Update 1: Neither. Now using something like:
window.addEventListener('load',function(){ if(document.getElementById('av_gmap_0')){ gmap_init(); } });But again, not sure if this is the recommended method, also there is no way to provide a unique ID to the map, so we just have to check if at least one map exists.
Update 2: Nope, also not the best way.
-
This reply was modified 6 years, 11 months ago by
SwitzerBaden. Reason: Added addEventListener option
December 6, 2018 at 1:01 pm #1041624Hi,
Have you tried using “DOMContentLoaded” instead of “load”? You can put the map inside a color section and then add a Section ID or apply a custom css class attribute to the map element itself.
Best regards,
Ismael -
This reply was modified 6 years, 11 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.
