-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
33 lines (30 loc) · 867 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const contact_panel = document.getElementById('contact_panel')
const observer = new IntersectionObserver( (entries) => {
entries.forEach( (entry) => {
if (entry.isIntersecting) {
entry.target.classList.add('show')
}
else {
entry.target.classList.remove('show')
}
})
})
const hidden_elements = document.querySelectorAll('.hidden')
// tell the observer to observe all hidden elements
hidden_elements.forEach( (el) => observer.observe(el))
function go_to_main() {
window.location.href = '../index.html#form'
}
function scrolldown() {
top_pos = contact_panel.offsetTop;
window.scrollTo({
top:top_pos - 60,
behavior:"smooth"
})
}
window.addEventListener('load', function() {
const hash = window.location.hash;
if (hash === '#form') {
scrolldown()
}
});