How can I add labels to markers and set timeout for mouseover on a map using the JavaScript API? -
i'm working on project in want add labels (text) below markers. have created each , set timeout mouseover
in order access link in infowindow
, how can that? have tried many options none of them seem work out. below code.
i want set labels , set timeout mouseover
event.
<script> function initmap() { //map options var options = { zoom: 9, center: { lat: 5.9670337, lng: -1.7945481 }, } //new map var map = new google.maps.map(document.getelementbyid('map'), options) var markers = [ { coords: { lat: 5.533038, lng: -1.277233 }, iconimage: 'https://developer.google.com/maps/documentation/javascript/examples/full/images/beachflag.png', content: '<strong>swedru</strong>' }, { coords: { lat: 5.9670337, lng: -1.7945481 }, content: '<strong>dunkwa </strong>' }, { coords: { lat: 5.1324545, lng: -1.4067053 }, content: '<strong>cape coast</strong>' }, { coords: { lat: 5.6817525, lng: -1.3094336 }, content: '<strong>assin fosu </strong>', }, { coords: { lat: 5.1324545, lng: -1.4067053 }, content: '<strong>cape coast </strong>', } ]; //loop through (var = 0; < markers.length; i++) { addmarker(markers[i]); } function addmarker(props) { var marker = new google.maps.marker({ position: props.coords, map: map }); //check iconimage if (props.iconimage) { //set iconimage marker.seticon(props.iconimage) } if (props.content) { var infowindow = new google.maps.infowindow({ content: props.content }); marker.addlistener('click', function() { infowindow.open(map, marker); }); infowindow.open(map, marker); } } } </script>
Comments
Post a Comment