Skip to content

Documenting how to add a toggable legend to the Esri Story Map Tour template

License

Notifications You must be signed in to change notification settings

pmacMaps/esri-storymap-tour-legend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Esri Story Map Tour with Map Legend

This repository shows how to add a Map Legend to the Esri Story Map Tour application. The following modifications have been made to the original template files:

  • added custom-style.css in the app directory
  • added custom-script.js in the app directory
  • added elements near line 320 in index.html

The legend is constructed using the esri/dijit/Legend component from the Esri ArcGIS JavaScript API (3.x). Please see the documentation for more information on this component.

The CSS style rules are placed in custom-style.css. The code to create and toggle the legend are placed in custom-script.js.

These two files are loaded into index.html by calling the respective loadCSS and loadJS functions, within the index.html file.

HTML Legend Elements

The following html elements comprise the container for the map legend, as well as the button that is clicked to open or close the legend.

<!-- Custom Map Legend -->
<div id="legendContainer">
   <!-- users click on button to open/close legend -->
	<button id="toggleLegend">Legend   <i id="legendBtnState" class='fa fa-arrow-down'></i></button>
	<!-- container for indiviual legend elements -->
	<div id="legendDiv"></div>
</div>
<!-- ./ Custom Map Legend -->