Best way to add scripts within a CartoDB infowindow

المشرف العام

Administrator
طاقم الإدارة
i am trying to implement a simple "zoom to this point" link within a CartoDB infowindow. To do this i figure i need:


  1. To be able to place a script within an infowindow (mustache) template, so that the zoom link can be dynamically set
  2. Access to the lat/lng value that was clicked
Its not clear to me whether the JS should be placed within the mustache template (nested tags seem a bit messy), or elsewhere - something like an "infowindow.complete" event would be ideal, but not sure if that exists.

Currently i have

My script does run, but i dont know how to access the lat/lng point. Is the information available within content.data? How can i debug what is in {{content}} ?

This post seems to provide an answer (ie use the 'featureClick' event, which has the lat/lng passed in), however the code doesn't fire for me - presumably because the content in the infowindow is not completed yet (hence my suggestion above)

Thanks for any pointers



أكثر...
 
أعلى