5

有一次,我读到一篇文章说 github 页面转换是由 pjax 完成的,我查看了jquery-pjax项目。我想我已经接近答案了,它一定与 eventpjax:start和相关pjax:end,但我仍然无法让它工作,所以我尝试在这里获得一些帮助。

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

但它没有任何影响

4

3 回答 3

4

Github 使用 HTML5 功能进行页面转换。这包括新的 JS History API 和 CSS3 转换。除了标准事件侦听、选择器之外,不涉及 jQuery。博客文章在这里包含所有相关链接 https://github.com/blog/760-the-tree-slider

于 2011-11-04T23:34:22.313 回答
1

Pjax : Demo , Source[Github]
是github用的..参考

于 2013-06-15T08:06:02.680 回答
1

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.

于 2012-01-04T21:40:50.070 回答