Start your CartoDB.js visualization projects at the speed of light with the CartoDB-generator.
Last active
April 13, 2016 15:08
-
-
Save ramiroaznar/0ad71bd30e1f74e5c332 to your computer and use it in GitHub Desktop.
a simple template made by the cartodb-generator
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
html, body, #map { | |
height: 100%; | |
width: 100%; | |
padding: 0; | |
margin: 0; | |
} |
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 lang="en"> | |
<head> | |
<title>CartoDB-generator Simple Template</title> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.15/themes/css/cartodb.css" /> | |
<link rel="stylesheet" href="index.css" media="screen"> | |
<link rel="shortcut icon" href="favicon.ico" /> | |
<script src="//localhost:9091"></script> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js"></script> | |
<script type="text/javascript" src="index.js"></script> | |
</body> | |
</html> |
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
;(function() { | |
function main() { | |
cartodb.createVis('map', 'http://documentation.cartodb.com/api/v2/viz/2b13c956-e7c1-11e2-806b-5404a6a683d5/viz.json', { | |
}) | |
.done(function(vis, layers) { | |
console.log('update') | |
// layer 0 is the base layer, layer 1 is cartodb layer | |
// setInteraction is disabled by default | |
layers[1].setInteraction(true); | |
layers[1].on('featureOver', function(e, latlng, pos, data) { | |
}); | |
// you can get the native map to work with it | |
var map = vis.getNativeMap(); | |
}) | |
.error(function(err) { | |
console.log(err); | |
}); | |
} | |
window.onload = main; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment