SightMap IFrame API CTA

by Jacob Pearlstein

HTML

<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>SightMap JavaScript IFrame API Example</title>
    <script src="https://sightmap.com/embed/api.js">


    </script>
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" type="text/css">

  </head>

  <body>
    <div class="margin">
      <div class="head-container">
        <div class="title">
          <div class="textbox">
            Welcome to SightMap
          </div>
        </div>
      </div>
      <br />
      <div class="sightmap-container">
        <iframe id="sightmap" src="https://sightmap.com/embed/zdqw9qr0po9?enable_api=1&origin=https://fiddle.jshell.net" frameborder="0" width="100%" height="100%"></iframe>
      </div>
    </div>
  </body>

</html>

CSS

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0 auto;
  padding: 0;
  font-family: open sans, sans-serif;
}

.margin {
  margin: 20px;
  height: 75%;
}

.head-container {
  width: 95%;
  margin: auto;
}

nav.container {
  display: block;
  background-color: #333333;
  text-align: center;
  margin: auto;
}

.nav-button {
  text-align: center;
  color: white;
  width: 100%;
}

.sightmap-container {
  height: 75%;
  min-height: 600px;
  align-items: center;
  justify-content: center;
}

.title {
  background-color: hsl(211, 38%, 61%);
  color: white;
  margin: auto;
  height: 15%;
}

.textbox {
  text-align: center;
  line-height: 233%;
  font-size: 40pt;
}

.button-list {
  display: flex;
  flex-direction: row;
}

JavaScript

document.addEventListener("DOMContentLoaded", function(event) {
  // Create a new embed instance, providing the IFrame id value:
  var embed = new SightMap.Embed('sightmap');

  embed.on('ready', function() {
    console.log('hello world');
  });

  // Entrata Tour - Outbound Link API
  embed.on('outbound.entrata.tour.click', function(event) {
    console.log(event);
  });
});