Skip to content

Instantly share code, notes, and snippets.

@iriberri
Created June 19, 2015 14:08
Show Gist options
  • Save iriberri/b17f488443ef3a3536f4 to your computer and use it in GitHub Desktop.
Save iriberri/b17f488443ef3a3536f4 to your computer and use it in GitHub Desktop.
Add attribution createVis
<!DOCTYPE html>
<html>
<head>
<title>Add attribution| CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
padding: 0;
margin: 0;
}
</style>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.12/themes/css/cartodb.css" />
</head>
<body>
<div id="map"></div>
<!-- include cartodb.js library -->
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.12/cartodb.js"></script>
<script>
function main() {
cartodb.createVis('map', 'http://documentation.cartodb.com/api/v2/viz/2b13c956-e7c1-11e2-806b-5404a6a683d5/viz.json')
.done(function(vis, layers) {
var map = vis.getNativeMap();
map.attributionControl.addAttribution("Adding more info here.");
}).on('error', function() {
cartodb.log.log("some error occurred");
});
}
window.onload = main;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment