I'm trying to make the following example work with the google maps v3
API
http://assets.marcgrabanski.com/resources/jquery-google-maps/tutorial-part2.html
I want to align the message box to a marker, when the side panel is
clicked
the following fromLatLngToDivPixel function does not work in v3
function showMessage(marker, text){
var markerOffset = map.fromLatLngToDivPixel(marker.getPoint());
$("#message").hide().fadeIn()
.css({ top:markerOffset.y, left:markerOffset.x })
.html(text);
}
to use the fromLatLngToDivPixel with v3 method i have added a overlay:
map = new google.maps.Map(document.getElementById("map"),
myOptions);
var overlay = new google.maps.OverlayView();
overlay.draw = function() {};
overlay.setMap(map);
and the changed the showMessage function to:
function showMessage(marker, text){
var markerOffset =
overlay.getProjection().fromLatLngToDivPixel(marker.getPosition());
$("#message").hide().fadeIn()
.css({ top:markerOffset.y, left:markerOffset.x })
.html(text);
}
This will show the message but it is not aligned to the marker, the
message is in a fixed position on the map. How can i align the message
to the marker position on the map?
thanks
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.