Tagged: feature
-
AuthorPosts
-
August 7, 2018 at 8:15 am #994263
Define new_map as global var in avia_google_maps_api.js:
Line 9 Add (see +):
// ------------------------------------------------------------------------------------------- +var new_map; (function($) {
Around Line 174 change (see – + Lines):
// must triggr 'resize' because if more then 1 map on page only the first is shown after confirm - var new_map = this.map; + new_map = this.map; setTimeout( function(){
– means remove + adding line.
After that change, its easy possible to add own stuff to the latest Google Maps loaded via Avia. Like that:
<script> jQuery(function(){ // Wait until avia fires API loaded jQuery('body').on('av-google-maps-api-loaded', function() { // wait 5 ms to work correctly setTimeout(function(){ map_object = new_map; //do whatever you want with the object var world_geometry = new google.maps.FusionTablesLayer({ query: { select: 'geometry', from: '1N2LBk4JHwWpOY4d9fobIn27lfnZ5MDy-NoqqRpk', }, map: map_object, suppressInfoWindows: true, }); }, 5); }); }); </script>
Its a small change, but afterwards the map object can be accessed easly. I do not knw another way to get the object.
- This topic was modified 6 years, 4 months ago by BlutVampir.
August 8, 2018 at 8:44 am #994721Hey BlutVampir,
Thank you for the hint – I’ll forward it to the developers.
Best regards,
DudeAugust 8, 2018 at 1:33 pm #994949Hi,
Your solution does not work when you have multiple google maps on a page.
As a workaround you can use a child theme, copy the element folder into the child theme and change the js in your child theme.
I think about another solution.
Best regards,
GünterAugust 10, 2018 at 10:09 am #995885Make an Global Array where the maps are in and increase x with every map.
var global_maps[x] = new_map;
As said, I know that it only works with one map as said. You will find a solution ;)
August 10, 2018 at 10:11 am #995887Hi,
We’ll look into it but I can’t promise it will be included with the next update.
Best regards,
DudeJuly 25, 2019 at 1:29 pm #1121892Not n yet unfortunetly. Any plan?
July 25, 2019 at 1:32 pm #1121894How can I deregister and exchange the script via Child Theme?
the same folderstructure doesn’t workk and I cant find the register_script stuff to remove it…
July 25, 2019 at 1:50 pm #1121898ok, habs gefunden:
add_action( 'wp_enqueue_scripts', 'reregister_enfoldmaps', 501); function reregister_enfoldmaps() { wp_dequeue_script( 'avia_google_maps_api_script' ); wp_deregister_script( 'avia_google_maps_api_script' ); wp_register_script( 'avia_google_maps_api_script' , get_stylesheet_directory_uri() . '/framework/js/conditional_load/avia_google_maps_api.js', array( 'jquery' ), avia_get_theme_version(), true ); wp_enqueue_script( 'avia_google_maps_api_script' ); }
working fine.
July 27, 2019 at 4:21 pm #1122345Hi BlutVampir,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.