How can I add street view of specific marker location theStore
to the map on #street
click event?
<button type="button" class="btn btn-default btn-sm" id="street">Street View</button>
JavaScript:
var theStore = {lat: -25.363, lng: 131.044};
var marker = new google.maps.Marker({
position: theStore,
map: map
});
google.maps.event.addDomListener(street, 'click', function () {
//Display Street View of theStore
});
You just have to set the position to the position of the certain marker:
panorama = map.getStreetView();
panorama.setPosition(theStore);
panorama.setVisible(true);