Here is the problem:
Lets say a Jquery toggle button which loads a Google Map upon request and hides its later when toggled:
$('#showmeMap').toggle(function()
{
var map = new GMap2($("#map").get(0));
var mapCenter = new GLatLng(-2, 20);
map.setCenter(mapCenter, 12);
$('#map').show();
}
}, function() {
$('#map').hide();
});
Then I add some random markers and later another function which removes markers from the map:
$('#destroyMarkersButton').click(function() {
for (var i=0; i<gmarkers.length; i++)
{
map.removeOverlay(gmarkers[i]);
}
});
When clicking on the button I´ve got the error Map is undefined. My thought was defining Google Map object globally:
map = new GMap2($("#map").get(0));
Which works perfectly in Firefox, however, map fails to load on internet explorer!!
Any suggestions ?