The Story Map Swipe and Spyglass app enables users to interact with two web maps or two layers of a single web map, depending on how you build your story. The app enables you to present a single view, or to develop a narrative showing a series of locations or views of the same maps.
This app can be an effective way to show before-and-after imagery, such as the aftermath of a storm or flood. A builder function in the app enables you to choose between the swipe or spyglass options. Although swipe provides a more efficient way for users to compare maps, the spyglass function is fun and engaging.
View it live | Swipe and Spyglass page on Esri Story Maps website | Download
Latest release is version version 1.19.0, if you want to be informed of new releases, we recommend you to watch this repository (see GitHub help). See the release page for release notes.
For more infomation about using and customizing Esri's Storytelling Apps follow the Story Maps Developers' Corner.
Help content:
The template is available in two versions:
So you don't have to download the template to use it! We freely host the template for you so you don't have to download the template and put it on your server. Using the hosted template is the easiest and fastest way to create a Swipe application and you will benefits from ArcGIS Online periodic updates that improve performance and fix issues without introducting breaking changes.
If you don't find the option you expect or you are a developer and want to enhance the application, you should use the downloadable version.
Main features are:
Note that a more complete documentation is included in the downloadable archive.
The swipe application require to be deployed on a web server like Internet Information Services(IIS).
c:\inetpub\wwwroot
The minimal steps to configure the application are the following:
More customization are accessible through three files :
Yes, some configuration parameter changed name but they are all available. UI customization will require changes.
Yes, the template is available in Portal for ArcGIS starting at version 10.2.
Not if you are deploying the template on a Portal instance. However, if you are deploying the template on a web server and your web map is deployed on a Portal for ArcGIS instance, you will need to make the appropriate changes to the swipe-config.js file in the app folder. Additional information on making these changes can be found in the swipe-config.js file around line 54.
We would love to hear from you!
Find a bug or want to request a new feature? Please let us know by submitting an issue.
Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing
Most of the look and feel customization can be done using the user download and including the css/html override directly into index.html. If you want to change the behavior of one functionality or want to add new one, you will need to read the developer guide below.
The easiest way to find the id or path to the DOM element that you want to customize is to use your browser developer tool, read documentation for for Chrome, Safari, Firefox.
Here are some customization examples that have to be included inside a \<style> element after the \<body> element like below :
...
<body class="claro">
<style>
#element {
/* changes */
}
</style>
<div id="header">
...
#headerDesktop {
background: url('resources/my_background.jpg');
}
To remove the bottom border:
#header {
background: none !important;
}
The button can now be disabled through app/swipe-config.js file and many other property are available.
To hide the text, empty the HEADER_LINK_TEXT property.
To display multiple line text, empty the HEADER_LINK_URL and configure HEADER_LINK_TEXT with html markup like
<a href='http://myorganization.com' target='_blank'>My organization</a><br /><a href='http://myorganization.com/myproject' target='_blank'>My project</a>
The logo image can be configured through app/swipe-config.js file. To hide the logo, empty the HEADER_LOGO_URL property.
The logo dimension is constrained to 250x50px. To use more horizontal or vertical space you need to remove this restriction using:
#headerDesktop .logo img {
max-width: none;
max-height: 90px;
}
You can save 10 more px by changing the top margin of the logo:
#headerDesktop .rightArea {
padding-top: 15px;
}
#headerDesktop .logo img {
max-width: none;
max-height: 100px;
}
This developer guide is intended to developer that wants to modify behavior or add new functionalities to the Swipe application. If you only need to customize look and feel of the application, you should be able to do so using the User download. It requires basic knowledge of HTML, Javascript and CSS languages.
Download and unzip the Developer download or clone the repo.
File | Contains |
---|---|
Swipe/ | Swipe source folder |
Swipe/src/ | The application source code |
Swipe/deploy/ | The ready to be deployed Swipe application |
Swipe/tools/ | Developer tools to build deploy/ from src/ |
Storytelling-Swipe-1.4.4.zip | User download archive |
Readme.pdf | The detailed readme guide |
Readme.md | This document |
storytelling-swipe-map-template-js.png | The application screenshot |
license.txt | The application license |
To build a production version of the application from the source code, you first need to install Node.js.
Then initialize the environment by running the following commands in the Swipe folder:
npm install
npm install -g grunt-cli
This will create a new node-modules
folder in your project root with all tools to build the project. If you have trouble running the second command, this may help you.
storymaps/core/Core.js
(look for // Automatic login in development mode
around line 150)app/swipe-config.js
(last properties)app/swipe-config.js
(you can use a relative path)webmap
and appid
to specify the item to be loaded (all parameters from index.html are ignored in development mode)grunt
The deploy folder now contains the built application that you can deploy to your web server.
Swipe relies on AMD and Dojo loader AMD for application structure.
The application is structured as this:
Path | Contains | |
---|---|---|
app/ | Package structured Javascript and CSS source code | |
app/swipe-config.js | Configuration file (loaded at execution time) | |
app/storymaps/builder/ | Builder modules common with other storymaps templates (main module is Builder.js) | |
app/storymaps/core/ | Core modules common with other storymaps templates (main module is Core.js) | |
app/storymaps/swipe/builder/ | UI components of the interactive builder (main module is BuilderView.js) | |
app/storymaps/swipe/core/ | Core modules (main module is MainView.js) | |
app/storymaps/swipe/ui/ | UI components of the viewer grouped by target device | |
app/storymaps/swipe/ui/Responsive.css | CSS Media queries rules | |
app/storymaps/swipe/BuildConfigBuilder.js | Require.js build configuration file for the interactive builder | |
app/storymaps/swipe/BuildConfigViewer.js | Require.js build configuration file for the viewer | |
app/storymaps/ui/ | UI components common with other storymaps templates | |
app/storymaps/utils/ | Utility modules common with other storymaps templates | |
lib/ | External dependencies | |
resources/nls/ | Externalized text strings of the application | |
resources/icons/ | Icons |
The main dependencies are:
Copyright 2013-2017 Esri
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
A copy of the license is available in the repository's license.txt file.