-
Notifications
You must be signed in to change notification settings - Fork 0
/
skills.js
101 lines (72 loc) · 2.34 KB
/
skills.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
function animateText(textSelector) {
var text = document.querySelector(textSelector);
var splitText = new SplitText(text, { type: "chars" });
var chars = splitText.chars;
gsap.set(chars, { visibility: "visible" });
gsap.from(chars, {
opacity: 0,
x: 10,
stagger: 0.05,
ease: "power1.inOut"
});
}
document.querySelectorAll('.skill-item').forEach(function(item) {
item.addEventListener('mouseenter', function() {
animateText('.skill-text');
});
});
var modal = document.getElementById("resumeModal");
var img = document.getElementById("skillstemplate8");
var span = document.getElementsByClassName("close")[0];
img.onclick = function() {
modal.style.display = "block";
}
span.onclick = function() {
modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
document.addEventListener('DOMContentLoaded', () => {
const toggleEffectsBtn = document.getElementById('toggle-effects');
if (localStorage.getItem('fancyEffects') === 'disabled') {
disableAdvancedEffects();
}
toggleEffectsBtn.addEventListener('click', () => {
const effectsDisabled = document.body.classList.toggle('fancy-effects-disabled');
if (effectsDisabled) {
disableAdvancedEffects();
} else {
enableAdvancedEffects();
}
localStorage.setItem('fancyEffects', effectsDisabled ? 'disabled' : 'enabled');
});
});
document.addEventListener('DOMContentLoaded', () => {
const toggleEffectsBtn = document.getElementById('toggle-effects');
if (localStorage.getItem('fancyEffects') === 'disabled') {
disableFancyEffects();
}
toggleEffectsBtn.addEventListener('click', () => {
if (document.body.classList.contains('fancy-effects-disabled')) {
enableFancyEffects();
localStorage.setItem('fancyEffects', 'enabled');
} else {
disableFancyEffects();
localStorage.setItem('fancyEffects', 'disabled');
}
});
});
function disableFancyEffects() {
document.body.classList.add('fancy-effects-disabled');
$('*').stop(true);
$('canvas').css('display', 'none');
gsap.globalTimeline.pause();
}
function enableFancyEffects() {
document.body.classList.remove('fancy-effects-disabled');
$('canvas').css('display', 'block');
gsap.globalTimeline.resume();
}