forked from rDrama/rDrama
Merge branch 'master' of https://github.com/Aevann1/Drama
commit
951d76e00a
|
@ -81,17 +81,14 @@
|
|||
// Toggle comment collapse
|
||||
|
||||
function collapse_comment(comment_id) {
|
||||
|
||||
const OFFSET = window.innerHeight / 3
|
||||
|
||||
const comment = "comment-" + comment_id;
|
||||
const comment = "comment-" + comment_id
|
||||
const element = document.getElementById(comment)
|
||||
const closed = element.classList.toggle("collapsed");
|
||||
const closed = element.classList.toggle("collapsed")
|
||||
const top = element.getBoundingClientRect().y
|
||||
|
||||
if (closed && top < OFFSET) {
|
||||
if (closed && top < 0) {
|
||||
element.scrollIntoView()
|
||||
window.scrollBy(0, - OFFSET)
|
||||
window.scrollBy(0, - 100)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue