Search code examples
iframegoogle-street-viewpointer-events

Streetview look around but not move around


I have embedded a streetview map that I want to only perform the action to look around (by click and drag with the mouse or with the compass) but not to move to a direction.

I tried by applying pointer-events to none but that stops all pointer actions.

Here is a link to my code: https://jsfiddle.net/Dimgk1984/8tnxo3as

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Street View controls</title>
   <style>
      /* Always set the map height explicitly to define the size of the div
       * element that contains the map. */
      #map {
        height: 100%;
      }
      /* Optional: Makes the sample page fill the window. */
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>
      <div class="map-container">
        <iframe src="https://www.google.com/maps/embed?pb=!4v1518736193836!6m8!1m7!1szChzPIAn4RIAAAQvxgbyEg!2m2!1d29.56028532748453!2d-95.08539144618427!3f213.12!4f0.18000000000000682!5f0.7820865974627469" style="margin-top:-100px" width="100%" height="1000" frameborder="0"allowfullscreen >
   </iframe>
        <style>
        .map-container {
        pointer-events: none;}
        </style>
  </body>
</html>

Solution

  • Try to set StreetViewPanoramaOptions to False and/or LinksControl. On Gmaps streetview API reference they also mention streetViewControl. Try it. Its pretty well documented on their reference page.