Skip to content

Instantly share code, notes, and snippets.

@graphis
Created December 4, 2012 07:35
Show Gist options
  • Save graphis/4201572 to your computer and use it in GitHub Desktop.
Save graphis/4201572 to your computer and use it in GitHub Desktop.
new pjax 1.2 init
/*
* new pjax 1.2 init
**/
function pjax_init()
{
$(document).pjax('a', '#content')
// 1
.on('pjax:beforeSend', function () { console.log('01 pjax:beforeSend'); })
.on('pjax:start', function()
{
// 2
console.log('02 pjax:start');
$(window).scrollTop(500);
$('#loader').show(10);
$('#content').fadeOut(500);
$('#content').hide();
})
// 3
.on('pjax:success', function() { console.log('03 pjax:success'); })
// 4
.on('pjax:complete', function () { console.log('04 pjax:complete'); })
.on('pjax:end', function()
{
// 5
console.log('05 pjax:end');
$('#loader').hide();
setTimeout(function() {
$('#content').fadeIn(500);
slider();
}, 500);
portfolio();
flicker();
})
.on('pjax:error', function () { console.log('pjax:error'); })
.on('pjax:timeout', function () { console.log('pjax:timeout'); })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment