mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-17 18:22:33 +00:00
Do not restart Pace on every pushState event
* See: https://github.com/next-theme/hexo-theme-next/issues/362
This commit is contained in:
parent
d1bf101cc1
commit
0005c0367f
2
layout/_third-party/index.njk
vendored
2
layout/_third-party/index.njk
vendored
@ -18,3 +18,5 @@
|
||||
{%- include 'tags/mermaid.njk' -%}
|
||||
|
||||
{%- include 'fancybox.njk' -%}
|
||||
|
||||
{%- include 'pace.njk' -%}
|
||||
|
||||
3
layout/_third-party/pace.njk
vendored
Normal file
3
layout/_third-party/pace.njk
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{%- if theme.pace.enable %}
|
||||
{{ next_js('third-party/pace.js') }}
|
||||
{%- endif %}
|
||||
@ -137,6 +137,10 @@ hexo.extend.filter.register('after_generate', () => {
|
||||
hexo.route.remove('js/third-party/fancybox.js');
|
||||
}
|
||||
|
||||
if (!theme.pace.enable) {
|
||||
hexo.route.remove('js/third-party/pace.js');
|
||||
}
|
||||
|
||||
if (!theme.quicklink.enable) {
|
||||
hexo.route.remove('js/third-party/quicklink.js');
|
||||
}
|
||||
|
||||
7
source/js/third-party/pace.js
vendored
Normal file
7
source/js/third-party/pace.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/* global Pace */
|
||||
|
||||
Pace.options.restartOnPushState = false;
|
||||
|
||||
document.addEventListener('pjax:send', () => {
|
||||
Pace.restart();
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user