Google Maps in tabs, marker not showing up or not centering
-
Hello, I am using the plugin inside tabs to generate maps in each tab. I have made it to work using this code…
<script type="text/javascript"> jQuery(function() { jQuery( "#tabs" ).tabs( { activate: function( event, ui ) { var mashup = jQuery( ".pgm", ui.newPanel ); var map = mashup.data( "google-maps" ); google.maps.event.trigger( map, "resize" ); } }); }); </script>
It is working fine, however, either the marker is not showing or the map is not centering to the location. It is not a mashup, just a simple map with a single location.
Here is the code for the PHP side.
<?php $lat = get_post_meta( get_the_ID(), '_pronamic_google_maps_latitude', true ); $lng = get_post_meta( get_the_ID(), '_pronamic_google_maps_longitude', true ); ?> <?php if ( function_exists( 'pronamic_google_maps' ) ) { pronamic_google_maps( array( 'width' => 1350, 'height' => 390, 'latitude' => $lat, 'longitude' => $lng, 'fit_bounds' => false, 'marker_options' => array( 'icon' => 'path to icon here' ), 'map_options' => array( 'styles' => array( (object) array( 'stylers' => array( (object) array( 'visibility' => 'on' ), (object) array( 'hue' => '#0008ff' ), (object) array( 'saturation' => '-100' ), ), ), ), ), ) ); } ?>
As you can see, I have also tried using the lat and lng to center it with fit bounds false, still the marker is not showing or maybe the map is not centered to that location. The marker is alright in the first tab though.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Google Maps in tabs, marker not showing up or not centering’ is closed to new replies.