mirror of
https://github.com/ziglang/zig.git
synced 2025-01-08 11:12:14 +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);
|
color: var(--link-color);
|
||||||
position: sticky;
|
position: sticky;
|
||||||
float: left;
|
float: left;
|
||||||
top: 0px;
|
top: 0.5em;
|
||||||
right: -16px;
|
right: -16px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
margin-left: -2em;
|
margin-left: -2em;
|
||||||
|
@ -2476,7 +2476,7 @@ var zigAnalysis;
|
|||||||
short = markdown(short);
|
short = markdown(short);
|
||||||
var long = markdown(docs);
|
var long = markdown(docs);
|
||||||
tdDesc.innerHTML =
|
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 {
|
else {
|
||||||
tdDesc.innerHTML = markdown(short);
|
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