Krafalski / ConsiderWater

A Web App For Anxious People
0 stars 0 forks source link

turbolinks and jQuery don't play nice #35

Closed Krafalski closed 8 years ago

Krafalski commented 8 years ago

Initially, jQuery works, but after clicking around the site, it stops working.

Had a hard time finding a $document.ready version that even worked at all with rails. Found one, but need to see if I can find one that does a little better?

Krafalski commented 8 years ago

updated to turbo links 5.0.0 beta. changed on load to:

 $(document).on('turbolinks:load', function() {
...
 });

from

$( document ).ready(function() {
 });

the latter worked the best (but still buggy) with the previous version of turbo links.

The new version seems to work consistently, however, if links are clicked on(trigger page loads) too quickly (one after the other) it breaks. This is still an improvement over the previous version, where a user could click about 3-4 times before jQuery stopped working.