You are using a browser that is no longer supported. Please use the latest version of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. For more information please see the System Requirements.
Skip To ContentArcGIS for DevelopersSign In Dashboard

Unsupported browser

You are using a browser that is not supported. JavaScript API works on the latest versions of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. Use one of these browsers and provide your feedback through GeoNet, the Esri Community.

  • {}
  • Firefox
  • Safari
  • undefined

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample uses multiple Swipe widgets to create an seemingly infinite scroll between different Educational Attainment layers in Mexico.

How it works

For each layer loaded from a WebMap, a swipe widget is created, and the layer is added to the trailingLayers.

// create a swipe widget for each layer
swipes = {
  return new Swipe({
    view: view,
    disabled: false,
    position: 100,
    direction: "vertical",
    trailingLayers: [layer],
    visibleElements: {
      handle: false,
      divider: true

When the user scrolls through the app, the leadingLayers and trailingLayers update as the Swipe widget's position changes to achieve the infinite scroll effect.

// To achieve this infinite scroll effect we need to swap the layers:
//   The layer starts at the bottom, the divider goes up.
//   Then the next layer starts to show up, so we put back the divider at the bottom and swap the layers.
if (position < 0 && swipe.trailingLayers.length) {
} else if (position >= 0 && swipe.leadingLayers.length) {

Sample search results