Created
September 28, 2012 12:39
-
-
Save johnnypez/3799573 to your computer and use it in GitHub Desktop.
getting turbolinks to play nice with FB SDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var fb_root; | |
$(document).on('page:fetch', function(){ | |
// store a ref to the fb-root element before changing the page | |
fb_root = $("#fb-root"); | |
}); | |
$(document).on('page:change', function(){ | |
// put back the fb-root element | |
if(fb_root) $('#fb-root').replaceWith(fb_root); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment