Skip to content

Instantly share code, notes, and snippets.

@johanbrook
Created May 30, 2011 14:54
Show Gist options
  • Save johanbrook/999011 to your computer and use it in GitHub Desktop.
Save johanbrook/999011 to your computer and use it in GitHub Desktop.
// As usual
$(document).ready(init);
// When the Ajax-event is complete, i.e. when the content is pulled in:
$(document).bind("pjax-complete", init);
function init(){
// Using Pjax (https://github.com/defunkt/jquery-pjax)
// Essentially just a wrapper around the .ajax() function which
// adds HTML5 pushState functionality.
$("a[href]:not( [data-pjax='false'] )").pjax("[role='main']");
$("selector").someOtherPlugin();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment