I am implementing Google Map with jQuery tab but not getting proper display.
I have tried this code to reCenter the map onclick of tab ID.
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery("#tab6").click(function() {
google.maps.event.trigger('location-canvas', 'resize');
map.setCenter(bounds.getCenter());
map.setZoom(16);
});
});
</script>
but didn't work.
I am using this tab script: Simple jQuery Responsive Tabs Interface Plugin - jQueryTab
And My JSFiddle is: Code
I will appreciate If you guide me and help me fix this problem.
Thanks.
'location-canvas'
, what is only a string, you must supply thegoogle.maps.Map
-instance as argumenttriggering the resize-event onclick may be too early, use the
after
-method of the plugin instead.Demo: http://jsfiddle.net/doktormolle/xzVpW/
Note: the
map
-variable is not available inside the after-method. In my modified fiddle I stored the instance inside$('#location-canvas').data