javascript - How to automatic display info window on Google maps? -


i have google map on website, has event "click" every infowindow. if click on marker, infowindow pop up. but, want infowindow's display automatically, without having click on them first.

this code, can me out?:

 var map = new google.maps.map(document.getelementbyid('map'), {                 // maps zoom level 16                 zoom: 16,                 // start location                 center: new google.maps.latlng(51.996098, 5.891174),                 // map style                 maptypeid: google.maps.maptypeid.hybrid             });              // info window             var infowindow = new google.maps.infowindow();              var marker, i;              // markers             (i = 0; < locations.length; i++) {                 marker = new google.maps.marker({                     position: new google.maps.latlng(locations[i][1],       locations[i][2]),                     map: map                 });                  google.maps.event.addlistener(marker, 'click', (function (marker, i) {                     return function () {                         infowindow.setcontent(locations[i][0]);                         infowindow.open(map, marker);                     }                 })(marker, i));             }                function clickroute(lati, long) {                 var latlng = new google.maps.latlng(lati, long);                 map.panto(latlng);             }         </script> 

each time create marker, create info window , open it:

var marker = new google.maps.marker({     position: new google.maps.latlng(locations[i][1], locations[i][2]),     map: map });  var infowindow = new google.maps.infowindow(); infowindow.setcontent(locations[i][0]); infowindow.open(map, marker); 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -