I'm using the gMap plugin for jQuery and need to call the native Google Map API's "resize" method after map initialisation. Can anyone tell me how I'd achieve that?
I'm initialising my map element this way, as per the gMap plugin documentation:
var defaults = {
latitude: 0,
longitude: 0,
zoom: 2,
scrollwheel: false
};
$('#myMap').gMap(defaults);
The tab that the map appears in is initially hidden, which I know causes draw problems for the Google Maps API (and subsequently many of us web developers it seems).
I've tried setting the map init every time the tab is shown, but this causes flicker and also causes the map display to reset to its default state--neither of which are acceptable, unfortunately.
So, triggering the API's "resize" method via gMaps; I've tried the following when showing the tab's content, but none of them work:
$('#myMap').resize();
$('#myMap').gMap(resize);
google.maps.event.trigger(myMap, 'resize');
$(window).resize();
I've tried asking for help from the gMap Twitter account, but it seems to have been abandoned.
I'd really appreciate a better brain than mine explaining how I can call GMap methods when using the gMap plugin for jQuery.