-
-
Save lustremedia/854b238f3f351f2ea43a to your computer and use it in GitHub Desktop.
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
// Handle previous/next navigation | |
$(function() { | |
// Requires jQuery 1.7+ to utilize the new "on" event attachment | |
$("#contentPadding").on("click", "a.prev, a.next", function (event) { | |
$.pjax({ | |
"url": $(this).attr("href"), | |
"fragment": "#contentPadding", | |
"container": "#contentPadding", | |
"complete": function(data) { | |
// Update the className on the BODY tag | |
var bodyClass = data.responseText && data.responseText.match(/<body[^>]+class\s*=\s*['"]([^'"]+)/); | |
if (bodyClass) { | |
$("body").attr("class", bodyClass[1]); | |
} | |
// Reinitialize AddThis if it's inside the loaded fragment | |
if (window.addthis) { | |
addthis.toolbox($(".addthis_toolbox").get(0)); | |
addthis.counter($(".addthis_counter").get(0)); | |
} | |
} | |
}); | |
event.preventDefault(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment