diff --git a/InputfieldMapMarker.js b/InputfieldMapMarker.js index a717b26..f6c477d 100644 --- a/InputfieldMapMarker.js +++ b/InputfieldMapMarker.js @@ -99,6 +99,23 @@ var InputfieldMapMarker = { } return true; }); + + // added by diogo to solve the problem of maps not rendering correctly in hidden elements + // trigger a resize on the map when either the tab button or the toggle field bar are pressed + $(document).ready(function() { + + // get the tab element where this map is integrated + $tab = $('#_' + $(map.b).closest('.InputfieldFieldsetTabOpen').attr('id')); + // get the inputfield where this map is integrated and add the tab to the stack + $inputFields = $(map.b).closest('.Inputfield').find('.InputfieldStateToggle').add($tab); + + $inputFields.on('click',function(){ + // give it time to open + window.setTimeout(function(){ + google.maps.event.trigger(map,'resize'); + }, 200); + }); + }); } };