Skip to main content
code fix
Source Link
javisantana
  • 1.6k
  • 9
  • 13

it's pretty easy:

 cartodb.createLayer(map, 'http://documentation.cartodb.com/api/v2/viz/2b13c956-e7c1-11e2-806b-5404a6a683d5/viz.json').addTo(map)
   .done(function(layer) {
        .addTo(map)
          var sublayer = layers[1]layer.getSubLayer(0);
      sublayer.set({ 'interactivity': ['cartodb_id', 'name'] });

      var i = new cdb.geo.ui.InfoBox({
          layer: layer,
          template: '<h3>{{name}}</h3><p>more info</p>',
          width: 200,
          position: 'bottom|right'
      });
      $('body').append(i.render().el);

  });

I'd recomend you to take a look to The Hobbit example: https://github.com/CartoDB/cartodb.js/blob/develop/examples/TheHobbitLocations/js/app.js

it's pretty easy:

 cartodb.createLayer(map, 'http://documentation.cartodb.com/api/v2/viz/2b13c956-e7c1-11e2-806b-5404a6a683d5/viz.json').done(function() {
        .addTo(map)
          var sublayer = layers[1].getSubLayer(0);
      sublayer.set({ 'interactivity': ['cartodb_id', 'name'] });

      var i = new cdb.geo.ui.InfoBox({
          layer: layer,
          template: '<h3>{{name}}</h3><p>more info</p>',
          width: 200,
          position: 'bottom|right'
      });
      $('body').append(i.render().el);

  });

I'd recomend you to take a look to The Hobbit example: https://github.com/CartoDB/cartodb.js/blob/develop/examples/TheHobbitLocations/js/app.js

it's pretty easy:

 cartodb.createLayer(map, 'http://documentation.cartodb.com/api/v2/viz/2b13c956-e7c1-11e2-806b-5404a6a683d5/viz.json').addTo(map)
   .done(function(layer) {
        
      var sublayer = layer.getSubLayer(0);
      sublayer.set({ 'interactivity': ['cartodb_id', 'name'] });

      var i = new cdb.geo.ui.InfoBox({
          layer: layer,
          template: '<h3>{{name}}</h3><p>more info</p>',
          width: 200,
          position: 'bottom|right'
      });
      $('body').append(i.render().el);

  });

I'd recomend you to take a look to The Hobbit example: https://github.com/CartoDB/cartodb.js/blob/develop/examples/TheHobbitLocations/js/app.js

fixed issue
Source Link
javisantana
  • 1.6k
  • 9
  • 13

it's pretty easy:

 cartodb.createLayer(map, 'http://documentation.cartodb.com/api/v2/viz/2b13c956-e7c1-11e2-806b-5404a6a683d5/viz.json').done(function() {
        .addTo(map)
          var sublayer = layers[1].getSubLayer(0);
      sublayer.set({ 'interactivity': ['cartodb_id', 'name'] });

      visvar i = new cdb.addOverlaygeo.ui.InfoBox({
        type  layer: 'infobox'layer,
          template: '<h3>{{name}}</h3><p>more info</p>',
          width: 200,
          position: 'bottom|right'
      });
      $('body').append(i.render().el); 

  });

I'd recomend you to take a look to The Hobbit example: https://github.com/CartoDB/cartodb.js/blob/develop/examples/TheHobbitLocations/js/app.js

it's pretty easy:

 cartodb.createLayer(map, 'http://documentation.cartodb.com/api/v2/viz/2b13c956-e7c1-11e2-806b-5404a6a683d5/viz.json').done(function() {
        .addTo(map)
          var sublayer = layers[1].getSubLayer(0);
      sublayer.set({ 'interactivity': ['cartodb_id', 'name'] });

      vis.addOverlay({
        type: 'infobox',
        template: '<h3>{{name}}</h3><p>more info</p>',
        width: 200,
        position: 'bottom|right'
      });
  });

I'd recomend you to take a look to The Hobbit example: https://github.com/CartoDB/cartodb.js/blob/develop/examples/TheHobbitLocations/js/app.js

it's pretty easy:

 cartodb.createLayer(map, 'http://documentation.cartodb.com/api/v2/viz/2b13c956-e7c1-11e2-806b-5404a6a683d5/viz.json').done(function() {
        .addTo(map)
          var sublayer = layers[1].getSubLayer(0);
      sublayer.set({ 'interactivity': ['cartodb_id', 'name'] });

      var i = new cdb.geo.ui.InfoBox({
          layer: layer,
          template: '<h3>{{name}}</h3><p>more info</p>',
          width: 200,
          position: 'bottom|right'
      });
      $('body').append(i.render().el); 

  });

I'd recomend you to take a look to The Hobbit example: https://github.com/CartoDB/cartodb.js/blob/develop/examples/TheHobbitLocations/js/app.js

Source Link
javisantana
  • 1.6k
  • 9
  • 13

it's pretty easy:

 cartodb.createLayer(map, 'http://documentation.cartodb.com/api/v2/viz/2b13c956-e7c1-11e2-806b-5404a6a683d5/viz.json').done(function() {
        .addTo(map)
          var sublayer = layers[1].getSubLayer(0);
      sublayer.set({ 'interactivity': ['cartodb_id', 'name'] });

      vis.addOverlay({
        type: 'infobox',
        template: '<h3>{{name}}</h3><p>more info</p>',
        width: 200,
        position: 'bottom|right'
      });
  });

I'd recomend you to take a look to The Hobbit example: https://github.com/CartoDB/cartodb.js/blob/develop/examples/TheHobbitLocations/js/app.js