-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
28 lines (26 loc) · 1.11 KB
/
script.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
const footerYearArea = document.querySelector('#Year')
footerYearArea.innerHTML = new Date().getFullYear()
const card = document.querySelector('#Card')
const mainHeader = document.querySelector('header')
const title = document.querySelector('.title')
const feature = document.querySelector('#Features')
const button = document.querySelector('button')
const image = document.querySelector('img')
card.addEventListener('mouseover', (e) => {
let xAxis = (window.innerWidth / 2 - e.pageX) / 15
let yAxis = (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)'
})