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 + '"]').classList.add('active') : null;
|
||||
|
||||
tableOfContentsElem.querySelector('ul') ?
|
||||
tableOfContentsElem.querySelector('ul').querySelectorAll('li').forEach(function (liElem) {
|
||||
tableOfContentsElem.querySelectorAll('ul') ?
|
||||
tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) {
|
||||
rootUl.querySelectorAll('li').forEach(function (liElem) {
|
||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||
ulElem.style.display = 'none';
|
||||
});
|
||||
}) : null;
|
||||
});
|
||||
}) : null;
|
||||
|
||||
var curElem = tableOfContentsElem.querySelector("[href='#" + id + "']");
|
||||
if (curElem && curElem.nextElementSibling) {
|
||||
|
@ -332,13 +334,14 @@
|
|||
tocElem.querySelector('a[href="#' + id + '"]') ?
|
||||
tocElem.querySelector('a[href="#' + id + '"]').classList.add('active') : null;
|
||||
|
||||
tableOfContentsElem.querySelectorAll('ul') ?
|
||||
tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) {
|
||||
rootUl.querySelectorAll('li').forEach(function (liElem) {
|
||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||
ulElem.style.display = 'none';
|
||||
});
|
||||
});
|
||||
});
|
||||
}) : null;
|
||||
|
||||
var curElem = tableOfContentsElem.querySelector("[href='#" + id + "']");
|
||||
if (curElem && curElem.nextElementSibling) {
|
||||
|
|
|
@ -121,10 +121,12 @@
|
|||
|
||||
if ((enableToc || toc) && document.querySelector('.toc')) {
|
||||
var tableOfContentsElem = document.querySelector('.toc').querySelector('#TableOfContents');
|
||||
tableOfContentsElem.querySelector('ul') ?
|
||||
tableOfContentsElem.querySelector('ul').querySelectorAll('li').forEach(function (liElem) {
|
||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||
ulElem.style.display = 'none';
|
||||
tableOfContentsElem.querySelectorAll('ul') ?
|
||||
tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) {
|
||||
rootUl.querySelectorAll('li').forEach(function (liElem) {
|
||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||
ulElem.style.display = 'none';
|
||||
});
|
||||
});
|
||||
}) : null;
|
||||
|
||||
|
@ -142,13 +144,6 @@
|
|||
});
|
||||
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 + '"]');
|
||||
if (curElem && curElem.nextElementSibling) {
|
||||
curElem.nextElementSibling.style.display = 'block';
|
||||
|
|
Loading…
Reference in New Issue