I know that officially google removed marker shadows in the v3 google APIs. With that in mind, I have a project where shadow shadows are required. I would like to put a shadow on the marker when the marker is clicked. Essentially, he adds an event listener to the marker, and when his click adds a shadow to the marker, as a way to show that clicking the marker is the active marker.
I read some pages, for example. marker shadows in google maps v3 that put shadows on all markers, but I would like to borrow from this example and add shadows when the marker is clicked and have the shadow removed when the marker loses focus, that is, when you click on another marker.
My jsfiddle with two markers to play with here, and the code below: jsfiddle here
var marker;
var locations = [["6","43.683","9.58","3002: Location 1",1],["7","45.149","9.44","3003: Location",2]];
function initialize() {
var mapProp = {
center: new google.maps.LatLng(43.683, 9.44),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP};
var map = new google.maps.Map(document.getElementById("googleMap"), mapProp);
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position:new google.maps.LatLng(locations[i][1], locations[i][2]),
icon:'https://maps.gstatic.com/mapfiles/ms2/micons/purple.png',
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
alert(locations[i][3] + " was clicked");
}
})(marker, i));
marker.setMap(map);
}
}
google.maps.event.addDomListener(window, 'load', initialize);
If someone can help in developing a strategy or even a piece of code to put shadows on the marker when it is clicked, I would be very pleased. Please feel free to deploy jsfiddle and add a link to it and post the link here.