Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="font-sans antialiased w-screen">
  <div class="w-screen flex flex-col space-x-0 h-screen">
    <div class="flex-1 min-w-full p-4">
      <h3 class="text-xl font-semibold">Update an iframe src to load specific map features in Mango</h3>
      <ol class="text-base p-4">
        <li>Select a state from the dropdown list
          </li>
        <li>click "Update map" to update the permalink used as the iframe src using jQuery.
          </li>
        </ol>
      <p class="text-sm p-4">Switch to the JS view to see how this works</p>
      <hr>
      <form>
        <label class="text-base font-semibold" for="id">Choose a state:</label>
        <select name="features" id="id" class="border px-1 py-1 rounded-lg">
          <option value="" selected disabled>Please select...</option>
          <option value="63">Florida</option>
          <option value="68">Kentucky</option>
          <option value="2">Montana</option>
          <option value="37">Washington</option>
        </select>
        
        
        <input type="button" class="transition duration-300 ease-in-out px-4 py-1 rounded-lg bg-green-400 cursor-pointer hover:bg-green-700 hover:text-white" value="Update map" onClick="newSite()" />
      </form>
    </div>
    <div class="mx-none flex-1 flex-grow">
      <iframe id="iframe" class="h-screen lg:w-screen md:w-screen sm:min-w-full"  src="https://mangomap.com/examples/maps/51841/category-map"></iframe>
    </div>
  </div>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                // Inserts the value from the state selection input into the iframe.src
// gid is an internal Mango id, but you can use any unique field=value pair.
// For example, field=state&value=Kentucky

function newSite() {
  var fid = $("#id").val();
  var newURL =
    "https://mangomap.com/examples/maps/51841/category-map?layer=c02f3720-15d4-11e6-86d6-06c182e4d011&field=gid&value=" +
    fid;
  var iframe = document.getElementById("iframe");
  iframe.src = newURL;
  iframe.src = iframe.src;
}

              
            
!
999px

Console