-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScript.js
More file actions
31 lines (23 loc) · 859 Bytes
/
Copy pathScript.js
File metadata and controls
31 lines (23 loc) · 859 Bytes
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
var notify = document.querySelector('.take-info');
var contact_btn = document.querySelector('.send-btn');
var give_info = document.querySelector('.give-info');
contact_btn.addEventListener('click', () => {
notify.style.display = "none";
give_info.style.display = "block";
})
// Scroll to top
// scroll top
const topbtn = document.getElementById('sc-top');
// when user scroll down 100px from the top of the document , shows the button
window.onscroll = function() { scrollFunction() };
function scrollFunction() {
if (document.body.scrollTop > 100 || document.documentElement.scrollTop) {
topbtn.style.display = "block";
} else {
topbtn.style.display = "none";
}
}
topbtn.addEventListener('click', () => {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
})