I have a Google Map that won't show up. The Problem seems to be the same in FF & Chrome, but even more bad in IE (always latest version).
In FF & Chrome I have a problem with the position: relative;
css element style. As soon as I switch to (with dev tools) position: absolute(or: fixed);
everything displays fine in FF. In Chrome the map only shows the upper 30% (from top).
In IE the map doesn't even get loaded.
Here's the script stuff from the <head>
. Content is only for testing and means nothing.
Note: I only use this to get the map loaded. This will be exchanged later.
<!-- Script inside <head> tag -->
<script type=text/javascript src=http://maps.google.com/maps/api/js?
file=api&
v=2&
key=<?php echo self::GOOGLE_API_KEY; ?>&
sensor=false>
</script>
<script type=text/javascript>
function initialize()
{
var startpos = new google.maps.LatLng( 50.978056,11.029167 );
var ops = {
zoom: 6
,center: startpos
,mapTypeId:
google.maps.MapTypeId.ROADMAP
,tileSize: new google.maps.Size( 256, 256 )
}
var map = new google.maps.Map( document.getElementById(map_canvas), ops );
var pos1 = new google.maps.LatLng( 50.7510776,12.4820724 );
var contentString1 = '<div align=left dir=ltr class=infowin><h3>test</h3>testen</div>';
var infowindow1 = new google.maps.InfoWindow( {
content: contentString1
,maxWidth: 5
} );
var marker1 = new google.maps.Marker( {
position: pos1
,map: map
,title: 'test'
} );
google.maps.event.addListener(
marker1
,'click'
,function() {
infowindow1.open( map, marker1 );
}
);
}
</script>
This is the whole mark up for the page.
<!-- html markup - There *really* isn't anything else -->
<body onload=initialize()>
<div id=map_canvas style=width:100%; height:100%;></div>
</body>
I have spend a lot of time on google without finding anything. Any ideas? Thanks!