-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
37 lines (29 loc) · 1.31 KB
/
script.js
File metadata and controls
37 lines (29 loc) · 1.31 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
let shiftButton = document.querySelector('.to-work');
let buttonText = document.querySelector('.to-work > p');
let isProject = true;
function textChanger() {
buttonText.classList.add('hidden');
setTimeout(() => {
buttonText.textContent = isProject ? 'visit card' : 'projects';
isProject = !isProject;
buttonText.classList.remove('hidden');
}, 650);
}
shiftButton.addEventListener('click', function(event) {
let rightDistance = window.innerWidth - shiftButton.getBoundingClientRect()['right'];
if (shiftButton.classList.contains('on')) {
document.querySelector('.content').classList.remove('hidden');
document.querySelector('.to-work').classList.remove('scaled');
document.querySelector('.my-works').classList.add('hidden');
textChanger();
shiftButton.style.setProperty('transform', 'none');
shiftButton.classList.remove('on');
} else {
document.querySelector('.content').classList.add('hidden');
document.querySelector('.to-work').classList.add('scaled');
document.querySelector('.my-works').classList.remove('hidden');
textChanger();
shiftButton.style.setProperty('transform', `translateX(${rightDistance + 105}px)`); //removed rotate(180deg)
shiftButton.classList.add('on');
}
})