Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
Here is a demo on how to use getComputedStyle() https://code.sololearn.com/W5CWbyyHqpl7/?ref=app I have give the image a 80vw width, try rotate screen to see the results
11th Jul 2020, 3:18 PM
Gordon
Gordon - avatar
+ 3
Wow, that's really fast 😱 And it's really funny to see own question in search result 😂
11th Jul 2020, 3:24 PM
Gordon
Gordon - avatar
+ 2
I checked your game and it works fine. Would you mind clarifying again. What's the problem with your current code?
11th Jul 2020, 2:54 PM
Gordon
Gordon - avatar
+ 2
getComputedStyle() then calculate new coordinates with ratio then update the coords of <area>s using Element.setProperty
11th Jul 2020, 3:06 PM
Gordon
Gordon - avatar
+ 2
let scale = currentImageHeight / originalImageHeight; let newValue = oldValue * scale;
12th Jul 2020, 4:14 AM
Gordon
Gordon - avatar
11th Jul 2020, 3:25 PM
Gordon
Gordon - avatar