1
0
Fork 0

Adding auto scroll

This commit is contained in:
Ethanell 2020-05-18 13:07:53 +02:00
parent 0b2db4f3d3
commit e69b9bc36b
2 changed files with 11 additions and 1 deletions

View file

@ -161,7 +161,7 @@ input:focus{
}
.hide{
/*display: none;*/
display: none;
}
h2#cookie_text{

View file

@ -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"});