-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
298 lines (271 loc) · 7.97 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
$(document).ready(function() {
$(window).scroll(function() {
// If page is scrolled more than 50px
if ($(this).scrollTop() >= 50) {
// Fade in the arrow
$('#scrollUp').fadeIn(200);
} else {
$('#scrollUp').fadeOut(200);
}
});
// When arrow is clicked
$('#scrollUp').click(function() {
$('body, html').animate({
// Scroll to top of body
scrollTop : 0
}, 500);
});
$(".openingChoice").on({
mouseenter: function () {
$(this).css("background-color", "black");
$(this).css("color", "white");
},
//If user chooses Developer
click: function () {
if (this.id == "chooseCoding") {
//Prompts and choices slide away from each other
$("#questionRow").animate({marginTop: "-450px"}, 3000);
$("#choiceRow").animate({marginTop: "1050px"}, 3000);
//Landing page fades away, switches flip on visibility
$("html").fadeOut(2000, "linear", function () {
//$("#openingQuestion").addClass("hidden");
//$("#codePageOne, #codePageTwo, #codePageFive").removeClass("hidden");
//Chosen page fades in
//$("webDev.html").fadeIn(3000, "linear");
window.location = "webDev.html";
});
$("#favicon").attr("href", "https://res.cloudinary.com/learicist/image/upload/v1678062766/Portfolio/favicon-code.ico");
//If user chooses Musician
} else if (this.id == "chooseMusic") {
//Prompts and choices slide away from each other
$("#questionRow").animate({marginTop: "-450px"}, 3000);
$("#choiceRow").animate({marginTop: "1050px"}, 3000);
//Landing page fades away, switches flip on visibility
$("html").fadeOut(2000, "linear", function () {
// $("#openingQuestion").addClass("hidden");
// $("#musicPageOne, #musicPageTwo, #musicPageFive").removeClass("hidden");
window.location = "music.html";
});
//Chosen page fades in
//$("music.html").fadeIn(3500, "linear");
$("#favicon").attr("href", "https://res.cloudinary.com/learicist/image/upload/v1678062766/Portfolio/favicon-guitar.ico");
}
},
mouseleave: function () {
$(this).css("background-color", "white");
$(this).css("color", "black");
}
});
//User clicks logo icon
$(".navbar-brand").on({
click: function (e) {
e.preventDefault();
//console.log("I was clicked bitch");
//If Coding Page is on screen
if (this.id == "eighthNoteBtn") {
//Fade out page user is leaving, flip switches
$("html").fadeOut(1000, "linear", function() {
$(".codePage").addClass("hidden");
window.location = "music.html";
});
$("#favicon").attr("href", "https://res.cloudinary.com/learicist/image/upload/v1678062766/Portfolio/favicon-guitar.ico");
} else if (this.id == "htmlTags") {
//Fade out page user is leaving, flip switches
$("html").fadeOut(1000, "linear", function() {
$(".musicPage").addClass("hidden");
window.location = "webDev.html";
});
$("#favicon").attr("href", "https://res.cloudinary.com/learicist/image/upload/v1678062766/Portfolio/favicon-code.ico");
}
}
});
//Hover on Nav options
$(".dropdown").on({
mouseenter: function() {
$(this).css("background-color", "#337ab7");
$("span", this).css("color", "white");
},
mouseleave: function() {
$(this).css("background-color", "white");
$("span", this).css("color", "#337ab7");
}
});
//User chooses Nav options
$(".codeLinks").on({
click: function(e) {
e.preventDefault();
console.log($(this).attr("id"));
//If chosen button ...
switch ($(this).attr("id")) {
//...is About
case "codeAboutBtn":
$(".codeBody").hide();
$("#codePageTwo").show();
$("#codeMenu").trigger("click");
$("#scrollUp").trigger("click");
break
//...is Portfolio
case "codePortBtn":
$(".codeBody").hide();
$("#codePageThree").show();
$("#codeMenu").trigger("click");
$("#scrollUp").trigger("click");
break
//...is Contact
case "codeContactBtn":
$(".codeBody").hide();
$("#codePageFour").show();
$("#codeMenu").trigger("click");
$("#scrollUp").trigger("click");
break
}
}
});
$(".musicLinks").on({
click: function (e) {
e.preventDefault();
console.log("music link clicked, codepage has hidden");
//If chosen button...
switch ($(this).attr("id")) {
//...is About
case "musicAboutBtn":
$(".musicBody").hide();
$("#musicPageTwo").show();
$("#musicMenu").trigger("click");
$("#scrollUp").trigger("click");
break
//...is Portfolio
case "musicPortBtn":
$(".musicBody").hide();
$("#musicPageThree").show();
$("#musicMenu").trigger("click");
$("#scrollUp").trigger("click");
break
//...is Gallery
case "musicGalleryBtn":
$(".musicBody").hide();
$("#musicPageFour").show();
$("#musicMenu").trigger("click");
$("#scrollUp").trigger("click");
break
//...is Contact
case "musicContactBtn":
$(".musicBody").hide();
$("#musicPageFive").show();
$("#musicMenu").trigger("click");
$("#scrollUp").trigger("click");
break
}
}
});
//Music page release of info
$(".accordionTriggers").on({
click: function() {
//console.log($(this).text());
switch ($(this).text()) {
case "Instruments:":
if ($("#instrumentCard").hasClass("hidden")) {
$(".accordionCards").hide();
$("#instrumentCard").show();
if (window.innerWidth < 770) {
scrollTo(0, 400);
}
} else {
$("#instrumentCard").hide();
}
break
case "On Stage:":
if ($("#stageCard").hasClass("hidden")) {
$(".accordionCards").hide();
$("#stageCard").show();
if (window.innerWidth < 770) {
scrollTo(0, 400);
}
} else {
$("#stageCard").hide();
}
break
case "Recording:":
if ($("#recordingCard").hasClass("hidden")) {
$(".accordionCards").hide();
$("#recordingCard").show();
if (window.innerWidth < 770) {
scrollTo(0, 400);
}
} else {
$("#recordingCard").hide();
}
break
case "Writing:":
if ($("#writingCard").hasClass("hidden")) {
$(".accordionCards").hide();
$("#writingCard").show();
if (window.innerWidth < 770) {
scrollTo(0, 400);
}
} else {
$("#writingCard").hide();
}
break
}
}
});
// Stage location reveals
$(".venueLink").on("click", function () {
switch ($(this).text()) {
case "Hudson Valley, NY":
$(".venueList").hide();
$("#hudson").show();
break
case "New York City":
$(".venueList").hide();
$("#nyc").show();
break
case "Binghamton, NY":
$(".venueList").hide();
$("#bing").show();
break
}
});
// Change size of accordion reveal div for mobile
if (window.innerWidth <= 650) {
$(".accordionCards").removeClass("col-md-8");
$(".accordionCards").addClass("col-md-4");
} else if (window.innerWidth > 651) {
$(".accordionCards").removeClass("col-md-4");
$(".accordionCards").addClass("col-md-8");
}
//Name at bottom of page
$(".myName").on({
mouseenter: function() {
$(this).css({
backgroundColor: "white",
color: "black",
textDecoration: "none",
padding: "5px",
borderRadius: "5px"
})
},
mouseleave: function() {
$(this).css({
backgroundColor: "transparent",
color: "white"
})
}
});
//Snap hamburger back in (mostly for mobile users)
$(".codePage").on("click", function () {
if ($("#codeMenu").attr("aria-expanded") === "true") {
//console.log('test');
$("#codeMenu").trigger("click");
}
});
//Same as above
$(".musicPage").on("click", function () {
if ($("#musicMenu").attr("aria-expanded") === "true") {
//console.log('test');
$("#musicMenu").trigger("click");
}
});
scrollUp();
});