Created
June 7, 2013 18:44
-
-
Save skorasaurus/5731452 to your computer and use it in GitHub Desktop.
t
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.0/mapbox.css' rel='stylesheet' /> | |
| <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" /> | |
| <!--[if lte IE 8]> | |
| <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.ie.css" /> | |
| <![endif]--> <script src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script> | |
| <style> | |
| body { margin:0; padding:0; } | |
| #map { position:absolute; top:0; bottom:0; width:100%; } | |
| </style> | |
| </head> | |
| <body> | |
| <style type='text/css'> | |
| body { | |
| font:20px/20px 'Helvetica Neue'; | |
| background:#f2efe9; | |
| } | |
| #swipe { | |
| background:#222; | |
| position:absolute; | |
| bottom:0; | |
| left:0; | |
| right:0; | |
| z-index:1000; | |
| padding:10px; | |
| height:30px; | |
| } | |
| #swipe #handle { | |
| position:absolute; | |
| height:20px; | |
| padding:5px; | |
| background:#fff; | |
| font-weight:bold; | |
| border:1px solid #333; | |
| color:blue; | |
| cursor:pointer; | |
| -webkit-user-select: none; | |
| } | |
| } | |
| #osm { | |
| position:absolute; | |
| left:10px; | |
| top:0px; | |
| font:30px/30px 'Helvetica Neue'; | |
| z-index:99; | |
| } | |
| #hot { | |
| position:absolute; | |
| right:10px; | |
| top:0px; | |
| font:30px/30px 'Helvetica Neue'; | |
| z-index:99; | |
| } | |
| </style> | |
| <div id='swipe'> | |
| <div id='handle'>drag</div> | |
| </div> | |
| <div id='map'></div> | |
| <h1 id='osm'>osm</h1> | |
| <h1 id='hot'>hot</h1> | |
| <script> | |
| var map = mapbox.map('map'), | |
| layers = document.getElementById('layers'); | |
| L.tileLayer('http://{s}.tile.cloudmade.com/API-key/997/256/{z}/{x}/{y}.png', { | |
| attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>', | |
| maxZoom: 18 | |
| }).addTo(map); | |
| map.addLayer(MM.TemplatedLayer('http://a.tiles.fluv.io/hdm/{z}/{x}/{y}.png')); | |
| map.addLayer(MM.TemplatedLayer('http://a.tile.openstreetmap.fr/2u/{z}/{x}/{y}.png')); | |
| map.zoom(13).center({ lat: 19.6405, lon: -71.8884 }); | |
| map.ui.hash.add(); | |
| var l_parent = map.getLayerAt(1).parent, | |
| handle = document.getElementById('handle'), | |
| dragging = false; | |
| handle.onmousedown = function() { dragging = true; return false;} | |
| document.onmouseup = function() { dragging = false; } | |
| document.onmousemove = function(e) { | |
| if (!dragging) return; | |
| setDivide(MM.getMousePoint(e, map).x); | |
| } | |
| function setDivide(x) { | |
| x = Math.max(0, Math.min(x, map.dimensions.x)); | |
| handle.style.left = (x - 20) + 'px'; | |
| l_parent.style.clip = 'rect(0px ' + x + 'px 9999999px 0px)'; | |
| } | |
| setDivide(300); | |
| </script> | |
| </body> | |
| </html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment