Why are the Google Maps Marker and InfoWindow not centered?
Problem
i make a map with this code
var map;
var myOptions = {
center: new google.maps.LatLng(-31.403759,-64.174232),
zoom: 12,
panControl: true,
zoomControl: true,
mapTypeControl: true,
scaleControl: true,
streetViewControl: true,
overviewMapControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
function iniciar() {
map = new google.maps.Map(document.getElementById("map"),myOptions);
}
function marcar(lat, lng) {
var contentString = ''+
''+
''+
'Uluru
'+
''+
'Uluru, also referred to as Ayers Rock, is a large ' +
'sandstone rock formation in the southern part of the '+
'Northern Territory, central Australia. It lies 335 km (208 mi) '+
'south west of the nearest large town, Alice Springs; 450 km '+
'(280 mi) by road. Kata Tjuta and Uluru are the two major '+
'features of the Uluru - Kata Tjuta National Park. Uluru is '+
'sacred to the Pitjantjatjara and Yankunytjatjara, the '+
'Aboriginal people of the area. It has many springs, waterholes, '+
'rock caves and ancient paintings. Uluru is listed as a World '+
'Heritage Site.
'+
'Attribution: Uluru, '+
'http://en.wikipedia.org/w/index.php?title=Uluru (last visited June 22, 2009).
'+
''+
'';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var location=new google.maps.LatLng(lat,lng);
var marker = new google.maps.Marker({
position: location,
map: maps
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
When I try to click on markers, they are decalibrated so that when I click on the center of a Marker nothing happens. But a few centimeters down, a cursor appears like the marker is at that point.
So the map is not centered and the marker appears at the real coordinates, but I have to click 2 cm down away from the marker for the click on the marker...
Why is that?? Has anybody else had this happen??
Solution
the problem was the body... in my css i put
body{
zoom:0.9;
margin:0;
padding:0;
width:100%;
}
the zoom affects the google maps remove the zoom calibrate the marker.... thank you all!! i hope this problem solve any other similar problems
and sry for my bad english! ejejej
Discussion
View additional discussion.