Created
September 24, 2018 14:51
-
-
Save shgidi/9327b380549f1a18a7689ec7a8015504 to your computer and use it in GitHub Desktop.
marker_listener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment