Hello,
I have successfully added event listeners to Google Maps objects (Map
and Marker).
Now I'm trying to add a classic event listener to an image (<img> TAG)
which is inside an OverlayView. I just want the image to change when
it is clicked.
I have tried may combinations but none of them has worked. I tried to
use 'google.maps.event.addListener',
'google.maps.event.addDomListener' and the standard
'addEventListener'.
I am sure the code of the listener function works because I have
tested it.
Here you have some code snippets, if you want the whole code just ask.
Code to create the image:
image = document.createElement('img');
image.src = 'caminante.png';
image.style.cssText = 'margin: 10px;';
image.id = 'caminante_menu';
//here I tried many ways to add the listener...
google.maps.event.addDomListener(image, 'click',
function () {
image.src = 'caminante_selected.png';
}
);
Code from the OverlayView constructor:
function MyOverlayView(opt_options){
...
div1.appendChild(image);
...
};
--
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.