SM JS IFrame API DisableUI Demo

disableUI call

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>

      <div tabindex="0" class="sightmap-container">
        <iframe id="sightmap" src="https://sightmap.com/embed/l27vqg8kwox?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: 1vh;
  height: 98vh;
}

.head-container {
  width: 100%;
  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: 80vh;
  width: 100%;
}

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

.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');

  console.log(embed);
  embed.disableUI(['filters', 'unitList', 'unitDetails', 'unitToolTip']);
  embed.on('ready', function() {
    console.log('hello world');
    // Disable filters and unit list using IFrame API. If desired, the floor selector, unit tooltips, and unit modals may be hidden.
    embed.disableUI(['filters', 'unitList', 'unitDetails', 'unitToolTip']);
  });
});