-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
83 lines (75 loc) · 2.56 KB
/
index.js
File metadata and controls
83 lines (75 loc) · 2.56 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
$(window).ready(function () {
$("#loadingSpinner").fadeOut(1000);
$(".fade-element-up").each(function (i) {
const top_of_object = $(this).offset().top;
const bottom_of_window = $(window).scrollTop() + $(window).height();
/* If the object is completely visible in the window, fade it */
if (bottom_of_window > top_of_object) {
$(this).addClass("reveal-up");
} else {
// reveal-up object reaches the in view port
$(window).scroll(function () {
$(".fade-element-up").each(function (i) {
const top_of_object = $(this).offset().top;
const bottom_of_window = $(window).scrollTop() + $(window).height();
if (bottom_of_window > top_of_object) {
$(this).addClass("reveal-up");
} else {
$(this).removeClass("reveal-up");
}
});
});
}
});
$(".home-btn").click(function() {
$('html, body').animate({
scrollTop: $(".home").offset().top
}, 800);
classAdd(".home-btn");
classRemove(".about-btn");
classRemove(".portfolio-btn");
classRemove(".contact-btn");
const top_of_object = $(".home").offset().top;
console.log(top_of_object)
});
$(".about-btn").click(function() {
$('html, body').animate({
scrollTop: $(".about-me").scrollTop()+600
}, 800);
classAdd(".about-btn");
classRemove(".home-btn");
classRemove(".portfolio-btn");
classRemove(".contact-btn");
const top_of_object = $(".about-me").offset().top;
console.log(top_of_object)
});
$(".portfolio-btn").click(function() {
$('html, body').animate({
scrollTop: $(".portfolio-me").scrollTop()+1500
}, 800);
classAdd(".portfolio-btn");
classRemove(".home-btn");
classRemove(".about-btn");
classRemove(".contact-btn");
const top_of_object = $(".portfolio-me").offset().top;
console.log(top_of_object)
});
$(".contact-btn").click(function() {
$('html, body').animate({
scrollTop: $(".contact-me").offset().top
}, 800);
classAdd(".contact-btn");
classRemove(".home-btn");
classRemove(".portfolio-btn");
classRemove(".about-btn");
const top_of_object = $(".contact-me").offset().top;
console.log(top_of_object)
});
function classAdd(vars) {
let classess = $(vars).addClass('active');
return classess;
}
function classRemove(vars) {
let classess = $(vars).removeClass('active')
}
});