-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
168 lines (137 loc) · 4.62 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
const mainContent = document.getElementById('main-content');
const loadingAnimation = document.getElementById('loading-animation');
/* practice for adding animation when clicking on a link
function linkAnimation() {
mainContent.style.display = 'none';
window.addEventListener("load", function(){
setTimeout(() => {
loadingAnimation.innerHTML =
}, 3000);
});
*/
function newJammingTab() {
window.open(
"https://jeffjhoyt.github.io/jammming/", "_blank");
}
function newTabTaskmanager() {
window.open(
"https://jeffjhoyt.github.io/JWD-Final-Project/", "_blank");
}
function newTabOrder() {
window.open(
"./projects/order-summary/index.html", "_blank");
}
function newTabBudget() {
window.open(
"./projects/expenses-chart-component-main/pj2.html", "_blank");
}
function NewTabLinkedin() {
window.open(
"https://www.linkedin.com/in/jeff-hoyt/", "_blank");
};
function NewTabBehance() {
window.open(
"https://www.behance.net/JeffHoyt", "_blank");
};
function NewTabHackerrank() {
window.open(
"https://www.hackerrank.com/jeffjhoyt", "_blank");
};
function newChoreDoorTab() {
window.open(
"./projects/choredoor/index.html", "_blank");
};
function newGoogleTab() {
window.open(
"./projects/googleClone/index.html", "_blank");
};
(function($) { "use strict";
//Parallax
function scrollBanner() {
$(document).on('scroll', function(){
var scrollPos = $(this).scrollTop();
$('.parallax-fade-top').css({
'top' : (scrollPos/2)+'px',
'opacity' : 1-(scrollPos/700)
});
$('.parallax-00').css({
'top' : (scrollPos/-3.5)+'px'
});
$('.parallax-01').css({
'top' : (scrollPos/-2.8)+'px'
});
$('.parallax-top-shadow').css({
'top' : (scrollPos/-2)+'px'
});
});
}
scrollBanner();
//Page cursors
document.getElementsByTagName("body")[0].addEventListener("mousemove", function(n) {
t.style.left = n.clientX + "px",
t.style.top = n.clientY + "px",
e.style.left = n.clientX + "px",
e.style.top = n.clientY + "px",
i.style.left = n.clientX + "px",
i.style.top = n.clientY + "px"
});
var t = document.getElementById("cursor"),
e = document.getElementById("cursor2"),
i = document.getElementById("cursor3");
function n(t) {
e.classList.add("hover"), i.classList.add("hover")
}
function s(t) {
e.classList.remove("hover"), i.classList.remove("hover")
}
s();
for (var r = document.querySelectorAll(".hover-target"), a = r.length - 1; a >= 0; a--) {
o(r[a])
}
function o(t) {
t.addEventListener("mouseover", n), t.addEventListener("mouseout", s)
}
//Scroll back to top
$(document).ready(function() {
var offset = 300;
var duration = 400;
jQuery(window).on('scroll', function() {
if (jQuery(this).scrollTop() > offset) {
jQuery('.scroll-to-top').addClass('active-arrow');
} else {
jQuery('.scroll-to-top').removeClass('active-arrow');
}
});
jQuery('.scroll-to-top').on('click', function(event) {
event.preventDefault();
jQuery('html, body').animate({scrollTop: 0}, duration);
return false;
})
/* Hero Case study images */
$('.case-study-name:nth-child(1)').on('mouseenter', function() {
$('.case-study-name.active').removeClass('active');
$('.case-study-images li.show').removeClass("show");
$('.case-study-images li:nth-child(1)').addClass("show");
$('.case-study-name:nth-child(1)').addClass('active');
})
$('.case-study-name:nth-child(2)').on('mouseenter', function() {
$('.case-study-name.active').removeClass('active');
$('.case-study-images li.show').removeClass("show");
$('.case-study-images li:nth-child(2)').addClass("show");
$('.case-study-name:nth-child(2)').addClass('active');
})
$('.case-study-name:nth-child(3)').on('mouseenter', function() {
$('.case-study-name.active').removeClass('active');
$('.case-study-images li.show').removeClass("show");
$('.case-study-images li:nth-child(3)').addClass("show");
$('.case-study-name:nth-child(3)').addClass('active');
})
$('.case-study-name:nth-child(4)').on('mouseenter', function() {
$('.case-study-name.active').removeClass('active');
$('.case-study-images li.show').removeClass("show");
$('.case-study-images li:nth-child(4)').addClass("show");
$('.case-study-name:nth-child(4)').addClass('active');
})
$('.case-study-name:nth-child(1)').trigger('mouseenter')
});
})(jQuery);