-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
62 lines (54 loc) · 1.69 KB
/
main.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// $('.burger').click(function(e) {
// e.preventDefault();
// $('.burger').toggleClass('toggle');
// $('.nav-links a').toggleClass('active');
// });
// $('.burger, .nav-links a').click(function(e) {
// e.preventDefault();
// $('body').toggleClass('no-overflow');
// $('.nav-links').toggleClass('open');
// });
function jumpToDiv(div) {
// if(div == 'home') {
// $('html, body').animate({
// scrollTop: 0
// }, 'slow');
// } else if(div == 'about') {
// $('html, body').animate({
// scrollTop: $('.about-section').offset().top
// }, 'slow');
// } else if(div == 'project') {
// $('html, body').animate({
// scrollTop: $('.project-section').offset().top
// }, 'slow');
// } else if(div == 'blog') {
// $('html, body').animate({
// scrollTop: $('.blog-section').offset().top
// }, 'slow');
// } else
if (div == "contact") {
$("html, body").animate(
{
scrollTop: $(".contact-section").offset().top,
},
"slow"
);
}
}
// Scroll to Top Functionality
const scrollButton = document.querySelector(".scroll-to-top");
// When the user clicks on the button, scroll to the top of the document
function scrollToTop() {
window.scrollTo({ top: 0, behavior: "smooth" });
}
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function () {
scrollFunction();
};
function scrollFunction() {
if (document.body.scrollTop > 30 || document.documentElement.scrollTop > 30) {
scrollButton.style.display = "block";
} else {
scrollButton.style.display = "none";
}
}