Skip to content

Instantly share code, notes, and snippets.

@TheMapSmith
Last active March 22, 2016 11:17
Show Gist options
  • Select an option

  • Save TheMapSmith/b9b4a46967462cdbc7f6 to your computer and use it in GitHub Desktop.

Select an option

Save TheMapSmith/b9b4a46967462cdbc7f6 to your computer and use it in GitHub Desktop.
Firef.ly style swipe
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.15.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.15.0/mapbox-gl.css' rel='stylesheet' />
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.0.1/mapbox-gl-compare.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.0.1/mapbox-gl-compare.css' type='text/css' />
<style>
body {
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;
width: 100%;
}
</style>
<div id='before' class='map'></div>
<div id='after' class='map'></div>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoiZmlyZWZseWV4cGVyaWVuY2UiLCJhIjoiY2ltMjMzcDBqMDBtMXZ1bTVtZnM2cHhvaCJ9.S9m1ZVBHs30IFBltV2fi_Q';
var before = new mapboxgl.Map({
container: 'before',
style: 'mapbox://styles/fireflyexperience/cim27fdrx007g9jkpxusgx7r1',
center: [0, 0],
zoom: 0
});
var after = new mapboxgl.Map({
container: 'after',
style: 'mapbox://styles/fireflyexperience/cim2js1e5009w9jm0ie7wgg3r',
center: [0, 0],
zoom: 0
});
new mapboxgl.Compare(before, after);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment