sections
This commit is contained in:
parent
2ab7de5687
commit
33be739566
1 changed files with 20 additions and 0 deletions
|
@ -124,6 +124,26 @@ function formatInfo(config, ascroll) {
|
||||||
if (!config.annotations.length && config.body) {
|
if (!config.annotations.length && config.body) {
|
||||||
var div = document.createElement('div')
|
var div = document.createElement('div')
|
||||||
div.innerHTML = config.body
|
div.innerHTML = config.body
|
||||||
|
var activate
|
||||||
|
var part = document.location.hash.slice(1) || 'part1'
|
||||||
|
div.querySelectorAll("h3.toggle").forEach(title => {
|
||||||
|
var section = title.nextElementSibling
|
||||||
|
if (part == title.id && section.style.display == "none") {
|
||||||
|
activate = title
|
||||||
|
}
|
||||||
|
title.onclick = event => {
|
||||||
|
section.style.display = section.style.display == "none" ? "block" : "none"
|
||||||
|
div.querySelectorAll("h3.toggle").forEach(other => {
|
||||||
|
if (other != title) {
|
||||||
|
var osection = other.nextElementSibling
|
||||||
|
osection.style.display = "none"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (activate) {
|
||||||
|
activate.click()
|
||||||
|
}
|
||||||
ascroll.appendChild(div)
|
ascroll.appendChild(div)
|
||||||
}
|
}
|
||||||
return info
|
return info
|
||||||
|
|
Loading…
Reference in a new issue