mapsense / mapsense.js

Mapsense.js
Other
88 stars 22 forks source link

Strange behavior when multiple base maps are added #18

Closed vb2317 closed 9 years ago

vb2317 commented 9 years ago

I added two maps to the index.html file by referring to the base-map example. When I zoom (in and out) on the second map, the first one also does the same thing.

Code:

<html>
  <head>
    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
    <script src="http://d3js.org/topojson.v1.min.js" charset="utf-8"></script>
    <script src="https://developer.mapsense.co/mapsense.js" charset="utf-8"></script>
    <link  type="text/css"  href="https://developer.mapsense.co/mapsense.css" rel="stylesheet"/>
    <style>
      body, html, #myMap{
        height: 70%;
        width: 70%;
        margin: 10px;
      } /* Sets the map to be full screen with no margin */
    </style>
    <style>
      body, html, #myMap2{
        height: 50%;
        width: 50%;
        margin: 40px;
      } /* Sets the map to be full screen with no margin */
    </style>
  </head>
  <body>
  <p>
    <div id="myMap"><div/>
  </p>
  <p>
    <div id="myMap2"><div/>
  </p>
    <script>
      var map = mapsense
        .map("#myMap") // Select a div to add the map to
        .add(mapsense.basemap().apiKey("key-2d5eacd8b924489c8ed5e8418bd883bc")) //add a basemap layer and append your API key
    </script>
    <script>
      var map = mapsense
        .map("#myMap2") // Select a div to add the map to
        .add(mapsense.basemap().apiKey("key-2d5eacd8b924489c8ed5e8418bd883bc")) //add a basemap layer and append your API key
    </script>
  </body>
</html>
mpruett commented 9 years ago

Your HTML is malformed. None of your div tags are closed. To close a div tag, use </div> rather than <div/>.