shgidi
9/24/2018 - 2:51 PM

marker_listener

marker_listener

  map.data.addListener('click', event => {

      let name = event.feature.getProperty('name');
      let desc = event.feature.getProperty('desc');
      let position = event.feature.getGeometry().get();
      let content = `
        <img style="float:left; width:10px; margin-top:30px">
        <div style="margin-left:120px; margin-bottom:20px;">
          <h2>${name}</h2>
          <p>${desc}</p>
          <p><img src="https://maps.googleapis.com/maps/api/streetview?size=350x120&location=${position.lat()},${position.lng()}&key=${apiKey}"></p>
        </div>
      `;
      infoWindow.setContent(content);
      infoWindow.setPosition(position);
      infoWindow.setOptions({pixelOffset: new google.maps.Size(0, -30)});
      infoWindow.open(map);
    });