+ 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
2 ответов
+ 6
something.style.top = parseInt(something.style.top)+1 + "px"
Or
something.style.top = +something.style.top.slice(0,-2)+1 + "px"
+ 2
parseFloat might be better.