- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
Latest commit
28 lines (26 loc) · 1.11 KB
/
Copy pathscript.js
File metadata and controls
28 lines (26 loc) · 1.11 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
constfooterYearArea=document.querySelector('#Year')
footerYearArea.innerHTML=newDate().getFullYear()
constcard=document.querySelector('#Card')
constmainHeader=document.querySelector('header')
consttitle=document.querySelector('.title')
constfeature=document.querySelector('#Features')
constbutton=document.querySelector('button')
constimage=document.querySelector('img')
card.addEventListener('mouseover',(e)=>{
letxAxis=(window.innerWidth/2-e.pageX)/15
letyAxis=(window.innerHeight/2-e.pageY)/15
card.style.transform=`rotateY(${xAxis}deg) rotateX(${yAxis}deg)`
})
card.addEventListener('mouseenter',(e)=>{
title.style.transform='translateZ(150px)'
feature.style.transform='translateZ(150px)'
button.style.transform='translateZ(150px)'
image.style.transform='translateZ(150px)'
})
card.addEventListener('mouseleave',(e)=>{
card.style.transform='rotateY(0deg) rotateX(0deg)'
title.style.transform='translateZ(0px)'
feature.style.transform='translateZ(0px)'
button.style.transform='translateZ(0px)'
image.style.transform='translateZ(0px)'
})