Reputation: 3500
I have a Javascript, which should work on $(document).ready
but it won't, because I also have to use turbolinks.
Is there a way to disable it for this script?
Or at least, is there a way to disable it for the view, I want my script to work on?
Sadly, my Site has to have allways the same layout file, as it is important for the corporate-style.
Ok, I found a way, how it should be done, but i don't know how to do it. In my application.html.erb, I have tp add
<body <% if(######) %> data-no-turbolinks <% end %> >
The Problem is, I don't know, how to check, if I'm on the Page. Can anyone give me a hint?
Upvotes: 1
Views: 998
Reputation: 95
current_page?(view_path) will check your if statement(not enought rep for comment this)
Upvotes: 3
Reputation: 11
1) turn off turbolinks - see http://blog.steveklabnik.com/posts/2013-06-25-removing-turbolinks-from-rails-4
2) use new page:load event that turbolinks fires - $(document).on('page:load', your_start_function);, see Rails Jquery doesn't work on other pages - guessing in your case it would be something like
Upvotes: 1