feat(compatibility): improve compatibility for Hugo basic version (#352)
This commit is contained in:
@@ -419,7 +419,7 @@ class Theme {
|
||||
const $tocLinkElements = $tocCore.querySelectorAll('a:first-child');
|
||||
const $tocLiElements = $tocCore.getElementsByTagName('li');
|
||||
const $headerLinkElements = document.getElementsByClassName('headerLink');
|
||||
const headerIsFixed = this.config.headerMode.desktop !== 'normal';
|
||||
const headerIsFixed = document.body.getAttribute('header-desktop') !== 'normal';
|
||||
const headerHeight = document.getElementById('header-desktop').offsetHeight;
|
||||
const TOP_SPACING = 20 + (headerIsFixed ? headerHeight : 0);
|
||||
const minTocTop = $toc.offsetTop;
|
||||
@@ -628,8 +628,8 @@ class Theme {
|
||||
|
||||
onScroll() {
|
||||
const $headers = [];
|
||||
if (this.config.headerMode.desktop === 'auto') $headers.push(document.getElementById('header-desktop'));
|
||||
if (this.config.headerMode.mobile === 'auto') $headers.push(document.getElementById('header-mobile'));
|
||||
if (document.body.getAttribute('header-desktop') === 'auto') $headers.push(document.getElementById('header-desktop'));
|
||||
if (document.body.getAttribute('header-mobile') === 'auto') $headers.push(document.getElementById('header-mobile'));
|
||||
if (document.getElementById('comments')) {
|
||||
const $viewComments = document.getElementById('view-comments');
|
||||
$viewComments.href = `#comments`;
|
||||
|
||||
Reference in New Issue
Block a user