Street View Side-By-Side
by Ricky Cuarez
HTML
<!DOCTYPE html>
<html>
<head>
<title>Street View split-map-panes</title>
<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
<!-- jsFiddle will insert css and js -->
</head>
<body>
<div id="street-view"></div>
<!-- Async script executes immediately and must be after any DOM elements used in callback. -->
<script
src="https://maps.googleapis.com/maps/api/js?&callback=initialize&libraries=&v=weekly"
async
></script>
</body>
</html>
CSS
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
#street-view {
height: 100%;
}
JavaScript
function initialize() {
const gpFarms = { lat: 4.836824, lng: 7.0115864 };
const streetDiv = document.getElementById("street-view");
const panorama = new google.maps.StreetViewPanorama(
streetDiv,
{
position: gpFarms
}
);
}