Home › Forums › Front-end Issues › ACF Google Maps Rendering › Reply To: ACF Google Maps Rendering
Hi thank you so much for this solution @jasonblackdog.
I have had same issue and have used exact same code with partial success. I have multiple tabs with multiple maps, the first map on click renders correctly but then all other maps after render out in the middle of the ocean instead of the actual location.
So I am guessing this is re-centering problem? Not quite sure
$(document).ready(function(){
$( 'a[data-toggle="tab"]' ).one( "click", function() {
$('.acf-map').each(function(){
render_map( $(this));
});
$(window).resize(function() {
$('.acf-map').height($(window).height() - 170);
});
$(window).trigger('resize');
//center = map.getCenter(); ???
//map.setCenter(center); ???
});
});
I have also added this in too under the center_map() call
google.maps.event.addListenerOnce(map, 'idle', function(){
google.maps.event.trigger(map, 'resize');
center_map(map);
});
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.