edit: this is now solved, see my answer below
The situation:
- User clicks on a map-image
- google maps API V3 is loaded via
ajax - the map is shown in a dialog window
/ lightbox
What happens:
The map displays and all functionality works however there’s a glitch with the top-left ‘square’ of the map.
I’m stuck!
edit: now with code:
<div id="map_canvas"></div>
<script type="text/javascript">
$(function() {
var latlng = new google.maps.LatLng(51.448359,-2.590559);
var options = {
zoom: 13,
center: latlng,
mapTypeControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map_canvas'), options);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(51.448359,-2.590559),
map: map
});
})
</script>
Thanks to Alphonso for pointing me in the correct direction.
The problem is in the dimensions of the map div, even though
#map_canvashad a height and width applied via css in the top of the document, it would seem the google maps API initializing before the style was being applied (this theory could be tested with dynatrace).*Easy solution:
1) inline styles for width and height*
2) delay the loading of the map with
setTimeout()