I am using the torque library hosted here: https://github.com/CartoDB/torque

I am using it in a viz.json-based visualization (so the torque layer is defined in the cartodb web console.) When I try to include a torque layer when I have imported JQuery, the visualization freezes with the following stacktrace: Uncaught TypeError: undefined is not a function cartodb.mod.torque.js:6 cdb.geo.ui.TimeSlider.cdb.geo.ui.InfoBox.extend.updateSlider cartodb.uncompressed.js:676 Backbone.Events.trigger cartodb.mod.torque.js:5 L.undefined.L.TorqueLayer.L.CanvasLayer.extend.setKey cartodb.mod.torque.js:5 (anonymous function) cartodb.mod.torque.js:3 r.time cartodb.mod.torque.js:3 r._tick

The torque visualization only works if I remove my import of JQuery, which breaks other parts of the website, such as the tabs() function.

Below are the imports I am using, the first works for Torque but breaks tabs(), the second works for tabs() but breaks Torque.

For Torque: <script src="dist/torque.uncompressed.js"></script> <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.js"></script> <script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.uncompressed.js"></script>

For no Torque: <script src="dist/torque.uncompressed.js"></script> <script src="http://code.jquery.com/jquery-1.10.2.js"></script> <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.js"></script> <script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.uncompressed.js"></script>

The tabs error occurs at: $('#windowtabs').tabs(); Uncaught TypeError: undefined is not a function

You should be able to simulate this problem by trying to load the different sets of libraries as I posted -- on the one hand the torque visualization will freeze (if jquery is loaded), on the other hand, the torque visualization will work, but .tabs() will create an error.

  • Hi @wovenhead Please, could you share your entire code? – Xatpy Jan 28 '15 at 11:57
  • The code is proprietary. I have included the relevant parts. The error occurs at $('#windowtabs').tabs(); – wovenhead Jan 28 '15 at 15:12

I think you might want to try to use CartoDB.js without jQuery in order to avoid conflicts between these libraries: http://libs.cartocdn.com/cartodb.js/v3/3.11/cartodb_nojquery.js

Another approach that you could follow is to use jQuery migrate, as explained in this issue: https://github.com/CartoDB/cartodb.js/issues/414

| improve this answer | |
  • It looks like the problem may have been fixed in the pull request related to issue #414 you linked. I can't confirm this myself because I'm no longer on this project. I'll accept your answer for now--but you may want to check for yourself that it works, and edit with your results – wovenhead Jul 31 '15 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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