Skip to content

Commit

Permalink
changed initSidebarScroll - run it earlier and don't wait for 'ready'…
Browse files Browse the repository at this point in the history
… event
  • Loading branch information
nk-o committed May 17, 2024
1 parent 3503b70 commit 5170592
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,30 @@ class DocsPress {

self.$singleAjax = document.querySelector('.docspress-single-ajax');

self.initSearch();
self.initDocSearch();
self.initAnchors();
self.initFeedbacks();
self.initSidebarScroll();
self.initAjax();
self.initEarlier();

on(document, 'ready', () => {
self.init();
});
}

// eslint-disable-next-line class-methods-use-this
stripHash(href) {
return href.replace(/#.*/, '');
}

initEarlier() {
this.initSidebarScroll();
}

init() {
this.initSearch();
this.initDocSearch();
this.initAnchors();
this.initFeedbacks();
this.initAjax();
}

initSearch() {
const self = this;
let timeout = false;
Expand Down Expand Up @@ -502,7 +513,5 @@ class DocsPress {
}
}

on(document, 'ready', () => {
// eslint-disable-next-line no-new
new DocsPress();
});
// eslint-disable-next-line no-new
new DocsPress();

0 comments on commit 5170592

Please sign in to comment.