pjax实现全站无刷新加载
pjax是一个jquery插件,它通过ajax和pushState技术提供了极速的(无刷新ajax加载)浏览体验
pjax的工作原理是通过ajax从服务器端获取HTML,在页面中用获取到的HTML替换指定容器元素中的内容。
注意:pjax依赖于jquery,确保你已经全局引入了jquery.js
安装
If you want to use the CDN instead of clone this repo, please jump to the Step 3.
Step 1 → Go to NexT dir
Change dir to NexT directory. There must be layout, source, languages and other directories:
1 | $ cd themes/next |
Step 2 → Get module
Install module to source/lib directory:
1 | $ git clone https://github.com/theme-next/theme-next-pjax source/lib/pjax |
Step 3 → Set it up
Enable module in NexT _config.yml file and select your theme:
1 | pjax: true |
And, if you wants to use the CDN, then need to set: (you also need to find your corresponding theme css link in jsdelivr)
1 | vendors: |
Update
1 | $ cd themes/next/source/lib/pjax |
署名-非商业性使用本文采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 ZEKALRYN'S BLOG!
评论
