I have been working from a sample on point clustering from cartodb. I would like to have an infowindow show when someone hovers over a series of points. This infowindow will display a different template if the points_count is greater than one. Any pointers on why in this case the info window is not showing up at all? When i do have the info window as part of the layer definition, i.e before calling addInteraction, is does show the default infowindow, but i want to have custom info windows based on the counts in the cluster.



1 Answer 1


So the issue I think is that your creating a new info window each time you hover over a feature

hovers[layer] = 1; var infowindow = new cdb.vis.Vis.addInfowindow(map, markerLayer.getSubLayer(layer), ['cartodb_id']); $('#map').append(infowindow.render().el); if(_.any(hovers)) { $('#map').append(infowindow.render().el); }

Instead what you want to do is to create the template in such a way that it will render differently when you have >1 point. You can set a flag in javascript before rendering the template as described here


and have two conditionals in the pop up template.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.