Skip to content

Instantly share code, notes, and snippets.

@wboykinm
Created April 21, 2017 19:41
Show Gist options
  • Save wboykinm/e01fa2f46f44207d6e0d6a95fe150674 to your computer and use it in GitHub Desktop.
Save wboykinm/e01fa2f46f44207d6e0d6a95fe150674 to your computer and use it in GitHub Desktop.
fresh block
license: mit
<!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.36.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.36.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<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>
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.1.0/mapbox-gl-compare.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.1.0/mapbox-gl-compare.css' type='text/css' />
<div id='before' class='map'></div>
<div id='after' class='map'></div>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoibGFuZHBsYW5uZXIiLCJhIjoicUtlZGgwYyJ9.UFYz8MD4lI4kIzk9bjGFvg';
var beforeMap = new mapboxgl.Map({
container: 'before',
style: 'mapbox://styles/landplanner/cj1s8npar000u2slicr695mj5',
center: [-73.186093, 44.490871],
zoom: 16
});
var afterMap = new mapboxgl.Map({
container: 'after',
style: 'mapbox://styles/mapbox/satellite-v9',
center: [-73.186093, 44.490871],
zoom: 16
});
var map = new mapboxgl.Compare(beforeMap, afterMap, {
// Set this to enable comparing two maps by mouse movement:
// mousemove: true
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment