+ 6

Let's say I have something.style.top = "Ypx", how to extract and increment that Y, if Y can be either negative or positive?

Y < innerHeight

5th Sep 2020, 7:41 AM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
2 ответов
+ 6
something.style.top = parseInt(something.style.top)+1 + "px" Or something.style.top = +something.style.top.slice(0,-2)+1 + "px"
5th Sep 2020, 7:51 AM
Namit Jain
Namit Jain - avatar
+ 2
parseFloat might be better.
5th Sep 2020, 8:15 AM
Nor'wester 🌪️ 🇧🇩 (INACTIVE)
Nor'wester 🌪️ 🇧🇩 (INACTIVE) - avatar