function hover(event) {
// mouse.x = (event.clientX / window.innerWidth) * 2 - 1
// mouse.y = -(event.clientY /500) * 2 + 1
if(window.innerWidth >=1024){
mouse.x = (event.clientX / 1000) * 2 - 1
console.log('큼'+mouse.x)
}else if( window.innerWidth >=768){
mouse.x = (event.clientX / window.innerWidth) * 2 - 1
console.log('중간'+mouse.x)
}else{
mouse.x = (event.clientX / 400) * 2 - 1
console.log('작음'+mouse.x)
}
if(window.innerWidth >=1024){
mouse.y = (event.clientY / window.innerHeight) * 2 + 1
}else if(window.innerWidth >=768){
mouse.y = (event.clientY / 500) * 2 + 1
}else{
mouse.y = (event.clientY / 300) * 2 + 1
}
The if statement should have a different mouse.x(y) operation depending on the browser size, but it does not work.
If you put it outside the if statement, it works one by one.
When I take a picture of the console, it is recognized fine.