don't mess up with scroll if page not long enough...
This commit is contained in:
parent
10c67230a6
commit
4c7af733c6
|
@ -9,12 +9,16 @@ window.addEventListener('scroll', function(e) {
|
|||
let grid = document.querySelector('.grid')
|
||||
let gridrect = mantletitle.getBoundingClientRect();
|
||||
|
||||
if ((document.querySelector('body').clientHeight - (grid.clientHeight + mantle.clientHeight + 32)) < window.innerHeight) {
|
||||
return
|
||||
}
|
||||
|
||||
if (gridrect.top < 20 && !grid.classList.contains('moved')) {
|
||||
grid.classList.add('moved');
|
||||
mantlebar.style.display = "inline";
|
||||
mantletitle.style.visibility = "hidden";
|
||||
grid.style.display = "none";
|
||||
window.scrollBy({top: grid.clientHeight + mantletitle.clientHeight, behavior: 'smooth'})
|
||||
window.scrollBy({top: mantletitle.clientHeight, behavior: 'smooth'})
|
||||
} else if (gridrect.top > 21 && grid.classList.contains('moved')) {
|
||||
grid.classList.remove('moved');
|
||||
mantletitle.style.visibility = "visible";
|
||||
|
|
Loading…
Reference in New Issue