I am trying to make a div visible at the position of the cursor when the cursor mouseover a marker using jQuery. Its kind of like a tooltip. However I cannot se
This gives the mouse position, works for me.
function CanvasProjectionOverlay() { }
CanvasProjectionOverlay.prototype = new google.maps.OverlayView();
CanvasProjectionOverlay.prototype.constructor = CanvasProjectionOverlay;
CanvasProjectionOverlay.prototype.onAdd = function () { };
CanvasProjectionOverlay.prototype.draw = function () { };
CanvasProjectionOverlay.prototype.onRemove = function () { };
In your initialize function;
canvasProjectionOverlay = new CanvasProjectionOverlay();
canvasProjectionOverlay.setMap(map);
and use it like this;
google.maps.event.addListener(marker, 'mouseover', function(event) {
var divPixel = canvasProjectionOverlay.getProjection().fromLatLngToContainerPixel(event.latLng);
x = divPixel.x;
y = divPixel.y;
});