maptastik
8/19/2016 - 2:00 PM

Lexington, KY - 1855

Lexington, KY - 1855

.title {
  position: absolute;
  right: 0;
  top: 10px;
  font-family: "Proxima Nova", Montserrat, sans-serif;
  text-align: right;
  max-width: 600px;
  z-index: 10001;
  background-color: rgb(14,14,14);
  background-color: rgba(14,14,14,0.6);
  padding-right: 15px;
  padding-left: 10px;
  border-bottom-left-radius: 5px;
  border-top-left-radius: 5px;
}
h1, h2 {
  font-weight: 100;
  color: #fff;
  line-height: 5px;
  text-shadow: 0 0 0.2em #000;
}
h1 {
  font-size: 2em;
}
h2 {
  font-size: 1em;
}
h2 a {
  color: #f1c40f;
}


.ui-opacity {
  background:#FFF;
  position:absolute;
  left:10px;
  top:70px;
  height:200px;
  width:28px;
  border:1px solid rgba(0,0,0,0.4);
  border-radius:3px;
  z-index:1000;
  }
.ui-opacity .handle {
  position:absolute;
  background:#404040;
  left:0;
  top:50px;
  width:26px;
  height:10px;
  border-radius:1px;
  cursor:pointer;
  cursor:ns-resize;
  }
  .ui-opacity .handle:hover {
    background:#303030;
    }
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Lexington, KY - 1855</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<link href="https://api.mapbox.com/mapbox.js/v2.4.0/mapbox.css" rel="stylesheet" />
<link href="style.css" rel="stylesheet">
<style>
  body { margin:0; padding:0; }
  #map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div class="title">
  <h1>Lexington, KY</h1>
  <h2><a href="http://mapwarper.net/maps/10505#Show_tab">1855 City Map</a></h2>
</div>
<div id="map"></div>
<div id="control" class="ui-opacity">
  <div id="handle" class="handle"></div>
</div>
<script src="https://api.mapbox.com/mapbox.js/v2.4.0/mapbox.js"></script>
<script src="app.js"></script>
</body>
</html>
L.mapbox.accessToken = 'pk.eyJ1IjoibWFwdGFzdGlrIiwiYSI6IjNPMkREV1kifQ.2KGPFZD0QaGfvYzXYotTXQ';
var handle = document.getElementById('handle'),
    start = false,
    startTop;

var map = L.mapbox.map('map', 'maptastik.nc2c5lfc',{
      minZoom: 16,
      maxZoom: 18
    })
    .setView([38.042966,-84.495238], 17);

var overlay = L.tileLayer('http://mapwarper.net/maps/tile/10505/{z}/{x}/{y}.png', {
      zIndex: 2,
      attribution: '<a href="http://libraries.uky.edu/" target="_blank">University of Kentucky Libraries</a>, <a href="http://mapwarper.net/" target="_blank">Map Warper</a>',
      opacity: 0.75
    })
    .addTo(map);

document.onmousemove = function(e) {
    if (!start) return;
    // Adjust control.
    handle.style.top = Math.max(-5, Math.min(195, startTop + parseInt(e.clientY, 10) - start)) + 'px';
    // Adjust opacity.
    overlay.setOpacity(1 - (handle.offsetTop / 200));
};

handle.onmousedown = function(e) {
    // Record initial positions.
    start = parseInt(e.clientY, 10);
    startTop = handle.offsetTop - 5;
    return false;
};

document.onmouseup = function(e) {
    start = null;
};
license: gpl-3.0
scrolling: no
height: 0