Binding $(document).ready events with Turbolinks
One problem we can get into when using turbolinks is that the binding for $(document).ready gets lost when the page changes location.
To solve this we have to bind the function again, using the page:change event of the window object.
do_on_load = ->
// function code
$ ->
do_on_load()
$(window).on('page:change', do_on_load)
Written by Wilbur Suero
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#