<div id='before' class='map'></div>
<div id='after' class='map'></div>
body {
          margin: 0;
          padding: 0;
          overflow: hidden;
        }
        body * {
           -webkit-touch-callout: none;
             -webkit-user-select: none;
                -moz-user-select: none;
                 -ms-user-select: none;
                     user-select: none;
        }
        .map {
          position: absolute;
          top: 0;
          bottom: 0;
          right: 0;
          width: 100%;
        }
        .compare-swiper {
            background-color: #262626 !important;
        }
mapboxgl.accessToken = 'pk.eyJ1Ijoic2luY2xhcml1cyIsImEiOiJjaXBvZjdxOXQwMXFvZnVtM3A4YmFrejN2In0.ze62-HAgTD4AOTZPmRJh_Q';

    var beforeMap = new mapboxgl.Map({
    container: 'before',
        style: 'mapbox://styles/sinclarius/cj239ctq000392rqctmchv3ki',
      minZoom: 15.1
    });

    var afterMap = new mapboxgl.Map({
    container: 'after',
    style: 'mapbox://styles/mapbox/light-v9',
    });

    var map = new mapboxgl.Compare(beforeMap, afterMap, {
    // Set this to enable comparing two maps by mouse movement:
    // mousemove: true
    });

External CSS

  1. https://api.mapbox.com/mapbox-gl-js/v0.36.0/mapbox-gl.css
  2. https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.1.0/mapbox-gl-compare.css

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/mapbox-gl/0.52.0/mapbox-gl.js
  2. https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.1.0/mapbox-gl-compare.js