jbdemonte/gmap3

how to add muptiple markers with different info windows?

Closed this issue · 1 comments

how to add muptiple markers with different info windows & custom map style?

thanks!

I did it like this

$('#gmap').gmap3({
  address:'Poland',
  zoom: 12
})
.marker(locations)
.infowindow(locations)
.then(function (infowindow) {
  var map = this.get(0);
  var marker = this.get(1);
  marker.forEach(function(item,i){
    item.addListener('click', function() {
      infowindow[i].open(map, item);
    });
  })
}).fit();

locations is a json object like
[{address:'street bla bla',content:'name of ponint'},... ]