I am creating a web map using CartoDB, and am having trouble creating buttons that will set a new view when clicked. I am a novice when it comes to coding but i do have some basic knowledge.
I'm thinking its going to involve creating a new visualization using CartoDB's .createvis command and a SQL statement but I'm not sure.
Any advice?
1 Answer 1
Here you have a working example with a "Reset Zoom" buttom. First you have to create a HTML kind of buttom:
<div id = 'reset'><p>Reset Zoom</p></div>
Second, you need to use JQuery in combination with the setView
CartoDB.js function:
$('#reset').click(function(){
map.setView([41.390205, 2.154007],12);
});