mirror of
https://github.com/ziglang/zig.git
synced 2025-01-07 18:52:08 +00:00
autodoc: scroll up when collapsing long fn description
This commit is contained in:
parent
a88679453a
commit
0e66df2094
@ -290,7 +290,7 @@
|
||||
color: var(--link-color);
|
||||
position: sticky;
|
||||
float: left;
|
||||
top: 0px;
|
||||
top: 0.5em;
|
||||
right: -16px;
|
||||
z-index: 1;
|
||||
margin-left: -2em;
|
||||
|
@ -2476,7 +2476,7 @@ var zigAnalysis;
|
||||
short = markdown(short);
|
||||
var long = markdown(docs);
|
||||
tdDesc.innerHTML =
|
||||
"<details><summary><div class=\"sum-less\">" + short + "</div>" + "<div class=\"sum-more\">" + long + "</div></summary></details>";
|
||||
"<details ontoggle=\"scrollOnCollapse(event);\"><summary><div class=\"sum-less\">" + short + "</div>" + "<div class=\"sum-more\">" + long + "</div></summary></details>";
|
||||
}
|
||||
else {
|
||||
tdDesc.innerHTML = markdown(short);
|
||||
@ -3718,5 +3718,12 @@ var zigAnalysis;
|
||||
|
||||
})();
|
||||
|
||||
|
||||
|
||||
function scrollOnCollapse(event) {
|
||||
const details = event.target;
|
||||
if (!details.open && details.getBoundingClientRect().top < 0) {
|
||||
console.log("scrolling!")
|
||||
details.parentElement.parentElement.scrollIntoView(true);
|
||||
} else {
|
||||
console.log("not scrolling!", details.open, details.top);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user