Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Why are the Google Maps Marker and InfoWindow not centered?

Why are the Google Maps Marker and InfoWindow not centered?


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, 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, '+ ' (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() {,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??

Problem courtesy of: andrescabana86


the problem was the body... in my css i put


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

Solution courtesy of: andrescabana86


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Why are the Google Maps Marker and InfoWindow not centered?


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription