Skip to content

Commit

Permalink
Support turbolinks 5 and previous versions
Browse files Browse the repository at this point in the history
  • Loading branch information
awead committed Jul 12, 2016
1 parent 518d905 commit 48f65b0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/assets/javascripts/browse_everything/behavior.js.coffee
Expand Up @@ -304,7 +304,11 @@ auto_toggle = ->
triggers = $('*[data-toggle=browse-everything]')
triggers.each () -> $(this).browseEverything($(this).data())

if Turbolinks?
$(document).on 'page:change', auto_toggle
if Turbolinks? && Turbolinks.supported
# Use turbolinks:load for Turbolinks 5, otherwise use the old way
if (Turbolinks.BrowserAdapter)
$(document).on 'turbolinks:load', auto_toggle
else
$(document).on 'page:change', auto_toggle
else
$(document).ready auto_toggle

0 comments on commit 48f65b0

Please sign in to comment.