Adding auto scroll
This commit is contained in:
parent
0b2db4f3d3
commit
e69b9bc36b
2 changed files with 11 additions and 1 deletions
|
@ -161,7 +161,7 @@ input:focus{
|
|||
}
|
||||
|
||||
.hide{
|
||||
/*display: none;*/
|
||||
display: none;
|
||||
}
|
||||
|
||||
h2#cookie_text{
|
||||
|
|
|
@ -21,6 +21,16 @@ main.querySelector("#email").addEventListener("keyup", e => {
|
|||
mailValid();
|
||||
});
|
||||
|
||||
let observer = new IntersectionObserver(function(entries) {
|
||||
if(entries[0].isIntersecting === true)
|
||||
window.scrollTo({top: entries[0].target.getBoundingClientRect().top + window.scrollY,
|
||||
left: 0,
|
||||
behavior: 'smooth'});
|
||||
}, { rootMargin: "0px", threshold: 0.2 });
|
||||
|
||||
for (let e of [main, resultMail, passwordTest, resultPassword, passwordManage, security2AF, cookie])
|
||||
observer.observe(e);
|
||||
|
||||
resultMail.querySelector("a").addEventListener("click", () => {
|
||||
passwordTest.classList.remove("hide");
|
||||
passwordTest.scrollIntoView({"behavior": "smooth"});
|
||||
|
|
Reference in a new issue