Merge branch 'master' of https://github.com/Aevann1/Drama
This commit is contained in:
commit
a664c7642a
1 changed files with 4 additions and 7 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue