Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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.
    #994721

    Hey BlutVampir,

    Thank you for the hint – I’ll forward it to the developers.

    Best regards,
    Dude

    #994949

    Hi,

    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ünter

    #995885

    Make 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 ;)

    #995887

    Hi,

    We’ll look into it but I can’t promise it will be included with the next update.

    Best regards,
    Dude

    #1121892

    Not n yet unfortunetly. Any plan?

    #1121894

    How 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…

    #1121898

    ok, 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.

    #1122345

    Hi BlutVampir,

    Glad you got it working for you! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.