toc folding bug fix
This commit is contained in:
parent
56e16a54b1
commit
8ccb48fd93
|
@ -268,12 +268,14 @@
|
||||||
tocElem.querySelector('a[href="#' + id + '"]') ?
|
tocElem.querySelector('a[href="#' + id + '"]') ?
|
||||||
tocElem.querySelector('a[href="#' + id + '"]').classList.add('active') : null;
|
tocElem.querySelector('a[href="#' + id + '"]').classList.add('active') : null;
|
||||||
|
|
||||||
tableOfContentsElem.querySelector('ul') ?
|
tableOfContentsElem.querySelectorAll('ul') ?
|
||||||
tableOfContentsElem.querySelector('ul').querySelectorAll('li').forEach(function (liElem) {
|
tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) {
|
||||||
|
rootUl.querySelectorAll('li').forEach(function (liElem) {
|
||||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||||
ulElem.style.display = 'none';
|
ulElem.style.display = 'none';
|
||||||
});
|
});
|
||||||
}) : null;
|
});
|
||||||
|
}) : null;
|
||||||
|
|
||||||
var curElem = tableOfContentsElem.querySelector("[href='#" + id + "']");
|
var curElem = tableOfContentsElem.querySelector("[href='#" + id + "']");
|
||||||
if (curElem && curElem.nextElementSibling) {
|
if (curElem && curElem.nextElementSibling) {
|
||||||
|
@ -332,13 +334,14 @@
|
||||||
tocElem.querySelector('a[href="#' + id + '"]') ?
|
tocElem.querySelector('a[href="#' + id + '"]') ?
|
||||||
tocElem.querySelector('a[href="#' + id + '"]').classList.add('active') : null;
|
tocElem.querySelector('a[href="#' + id + '"]').classList.add('active') : null;
|
||||||
|
|
||||||
|
tableOfContentsElem.querySelectorAll('ul') ?
|
||||||
tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) {
|
tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) {
|
||||||
rootUl.querySelectorAll('li').forEach(function (liElem) {
|
rootUl.querySelectorAll('li').forEach(function (liElem) {
|
||||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||||
ulElem.style.display = 'none';
|
ulElem.style.display = 'none';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}) : null;
|
||||||
|
|
||||||
var curElem = tableOfContentsElem.querySelector("[href='#" + id + "']");
|
var curElem = tableOfContentsElem.querySelector("[href='#" + id + "']");
|
||||||
if (curElem && curElem.nextElementSibling) {
|
if (curElem && curElem.nextElementSibling) {
|
||||||
|
|
|
@ -121,10 +121,12 @@
|
||||||
|
|
||||||
if ((enableToc || toc) && document.querySelector('.toc')) {
|
if ((enableToc || toc) && document.querySelector('.toc')) {
|
||||||
var tableOfContentsElem = document.querySelector('.toc').querySelector('#TableOfContents');
|
var tableOfContentsElem = document.querySelector('.toc').querySelector('#TableOfContents');
|
||||||
tableOfContentsElem.querySelector('ul') ?
|
tableOfContentsElem.querySelectorAll('ul') ?
|
||||||
tableOfContentsElem.querySelector('ul').querySelectorAll('li').forEach(function (liElem) {
|
tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) {
|
||||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
rootUl.querySelectorAll('li').forEach(function (liElem) {
|
||||||
ulElem.style.display = 'none';
|
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||||
|
ulElem.style.display = 'none';
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}) : null;
|
}) : null;
|
||||||
|
|
||||||
|
@ -142,13 +144,6 @@
|
||||||
});
|
});
|
||||||
elem.classList.add('active');
|
elem.classList.add('active');
|
||||||
|
|
||||||
tableOfContentsElem.querySelector('ul') ?
|
|
||||||
tableOfContentsElem.querySelector('ul').querySelectorAll('li').forEach(function (liElem) {
|
|
||||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
|
||||||
ulElem.style.display = 'none';
|
|
||||||
});
|
|
||||||
}) : null;
|
|
||||||
|
|
||||||
var curElem = tableOfContentsElem.querySelector('[href="#' + id + '"]');
|
var curElem = tableOfContentsElem.querySelector('[href="#' + id + '"]');
|
||||||
if (curElem && curElem.nextElementSibling) {
|
if (curElem && curElem.nextElementSibling) {
|
||||||
curElem.nextElementSibling.style.display = 'block';
|
curElem.nextElementSibling.style.display = 'block';
|
||||||
|
|
Loading…
Reference in New Issue