Skip to content

Instantly share code, notes, and snippets.

@luruke
Created February 7, 2016 17:03
Show Gist options
  • Save luruke/5bf738285ad957955288 to your computer and use it in GitHub Desktop.
Save luruke/5bf738285ad957955288 to your computer and use it in GitHub Desktop.
Add barba on wikipedia
// Barba wikipedia.org
var js = document.createElement('script');
js.type = 'text/javascript';
js.onload = initBarba;
js.src = 'https://luruke.github.io/barba.js/dist/barba.min.js';
document.body.appendChild(js);
function initBarba() {
Barba.Pjax.Dom.parseContainer = function(el) {
return el.querySelector('#content');
};
Barba.Pjax.Dom.putContainer = function(el) {
var footer = document.getElementById('footer');
footer.parentNode.insertBefore(el, footer);
};
Barba.Pjax.init();
Barba.Prefetch.init();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment