Created
November 6, 2015 15:34
-
-
Save oriolbx/7f56327932c87987bdc5 to your computer and use it in GitHub Desktop.
custom Torque slider
This file contains 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> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> | |
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.15/themes/css/cartodb.css" /> | |
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js"></script> | |
<style> | |
html, body, #map { | |
height: 100%; | |
padding: 0; | |
margin: 0; | |
} | |
div.cartodb-timeslider { | |
left:10px!important; | |
right:10px!important; | |
top: 10px!important; | |
height:50px; | |
width: 50%; | |
background-color: #000; | |
} | |
li.controls, | |
li.time { | |
position:absolute; | |
top:-5px; | |
border:2!important; | |
z-index:10; | |
left: 40%; | |
} | |
li.controls { | |
left:50%; | |
margin-left:-50px; | |
} | |
div.cartodb-timeslider li.last { | |
position:absolute; | |
left:15px; | |
right:15px; | |
z-index:2; | |
} | |
div.cartodb-timeslider .slider { | |
width: 100%; | |
background-color: red; | |
} | |
div.cartodb-timeslider .slider-wrapper { | |
position:absolute; | |
left:0; | |
right:0; | |
width:100%; | |
padding:30px 0 15px; | |
background-color: #000; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script> | |
function main() { | |
var map; | |
// center and zoom level | |
var options = { | |
center: [20, 20], | |
zoom: 2, | |
}; | |
var map_object = new L.Map('map', options); | |
L.tileLayer('http://{s}.tile.openstreetmap.org/{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>' | |
}).addTo(map_object); | |
cartodb.createLayer(map_object, 'https://team.cartodb.com/u/oboix/api/v2/viz/ea3f702c-6b78-11e5-8720-0e787de82d45/viz.json') | |
.addTo(map_object); | |
} | |
window.onload = main; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment