From 5b0352c7eeeb072d2e06098cf5d8fc30dc2e3ebf Mon Sep 17 00:00:00 2001 From: diogo oliveira Date: Sat, 28 Sep 2013 16:06:18 +0100 Subject: [PATCH] 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 --- InputfieldMapMarker.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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); + }); + }); } };