How to make github style page transitions by pjax

后端 未结 3 650
温柔的废话
温柔的废话 2021-01-05 19:59

Once a time, I read an article said that github page transition is made by pjax, I checked jquery-pjax project. I think I have close to the answer, it must be something rela

3条回答
  •  情书的邮戳
    2021-01-05 20:15

    I don't know if this is relevant at all. But I've been using Pjax myself and the code above has a syntax error, should be:

    $('a.pjax').pjax('#main');
    $('#main').bind('pjax:start', function(){$('#main').slideUp()})
    .bind('pjax:end', function(){$('#main').slideDown()});
    

    Edit: Yes, sorry for not pointing that out. Exactly as @Udo Held said: You need to remove the bracket after 'pjax:end' or else it will not follow through and execute the $('#main').slideDown() function.

提交回复
热议问题