Skip to content

Instantly share code, notes, and snippets.

@jackprophesy
Created October 5, 2012 06:24
Show Gist options
  • Save jackprophesy/3838395 to your computer and use it in GitHub Desktop.
Save jackprophesy/3838395 to your computer and use it in GitHub Desktop.
document ready turbolinks
--THIS------------------------------------------
$(document).ready ->
$("a[rel=popover]").popover()
--OR THIS---------------------------------------
$ ->
$("a[rel=popover]").popover()
--BECOMES---------------------------------------
initPage = ->
$("a[rel=popover]").popover()
$ ->
initPage()
$(window).bind "page:change", ->
initPage()
@davydotcom
Copy link

it may also be pertinant to use page:load as page:change does not reset dom listeners anymore when hitting the back button. but page:load fires when a page is actually fetched and created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment