Reputation: 265
I have set up "clean" map (with Google Maps API v3) with no labels in my website, now a user can select some cities from a dropdown menu and the markers of the selected cities should appear on the map also showing the name of the city as if it was part of the marker. I can't use an InfoWindow because I need it for other informations, so is there a way to reach my goal? Thank you in advance.
Here is a screenshot of what should appear when some cities are selected.
Upvotes: 1
Views: 2241
Reputation: 3106
You can use Markers with Labels Library..Here is the code
labelAnchorPos = new google.maps.Point(25, 10); // you can adjust it as you require
marker = new MarkerWithLabel({
position : new google.maps.LatLng(lat,.lon),
icon : './img/img/yourIMG.png',
labelContent : labelContentValue,
labelAnchor : labelAnchorPos,
labelClass : "labels", // the CSS class for the label
labelInBackground : false
});
You can then show/hide labels of selected markers as required
Upvotes: 2