UF Land Use Category Slider
Comparing L2 & L4 in Oakland
by sk_urbanfootprint
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Land Use in UrbanFootprint</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.0.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.0.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%;
}
.mapboxgl-compare::before {
content: 'Level 4';
margin-top: 155px;
margin-left: -100px;
padding-left: 20px;
border-radius: 30px 0 0 30px;
}
.mapboxgl-compare::after {
content: 'Level 2';
margin-top: -50px;
margin-right: -100px;
padding-left: 35px;
border-radius: 0 30px 30px 0;
border-left: 1px solid white;
}
.mapboxgl-compare::before,
.mapboxgl-compare::after {
display: block;
background-color: #111;
font-size: 12px;
color: #FFF;
font-weight: bold;
padding-top: 15px;
padding-bottom: 15px;
}
</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.eyJ1IjoicG9seWdvbnMiLCJhIjoiY2ltd2FwZ2VzMDMzNHY3a2t4Znp0NTh1dyJ9.zvNdPb1M0EDbM8f7uEykLw';
// Set bounds to Oakland, CA
var bounds = [
[-122.315, 37.762], // Southwest coordinates
[-122.200, 37.850] // Northeast coordinates
];
var beforeMap = new mapboxgl.Map({
container: 'before',
style:...