Skip to content

Instantly share code, notes, and snippets.

@maptastik
Last active August 5, 2016 15:37
Show Gist options
  • Save maptastik/630fcaa47155c8ad5216639a9974757e to your computer and use it in GitHub Desktop.
Save maptastik/630fcaa47155c8ad5216639a9974757e to your computer and use it in GitHub Desktop.
The Summit at Fritz Farm Development Plan
L.mapbox.accessToken = 'pk.eyJ1IjoibWFwdGFzdGlrIiwiYSI6IjNPMkREV1kifQ.2KGPFZD0QaGfvYzXYotTXQ';
var handle = document.getElementById('handle'),
start = false,
startTop;
var map = L.mapbox.map('map', 'maptastik.nc2c5lfc',{
minZoom: 14,
maxZoom: 20
})
.setView([37.976760,-84.526534], 17);
var overlay = L.mapbox.tileLayer('maptastik.fritz-farm', {
zIndex: 2,
attribution: '<a href="https://www.lexingtonky.gov/" target="_blank">LFUCG</a>'
})
.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;
};
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Fritz Farm - Development Plan, 2016</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>The Summit at Fritz Farm</h1>
<h2><a href="https://github.com/ryan-m-cooper/commonwealth-of-openness/files/404070/DP.2016-36.Fritz.Farm.Summit.Lexington.amd.b.pdf">Development Plan 2016-36</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>
.title {
position: absolute;
right: 20px;
top: 10px;
font-family: "Proxima Nova", Montserrat, sans-serif;
text-align: right;
max-width: 600px;
z-index: 10001;
}
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:20px;
width:26px;
height:10px;
border-radius:1px;
cursor:pointer;
cursor:ns-resize;
}
.ui-opacity .handle:hover {
background:#303030;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment