+ 2
How I can get information about margin-X of the object without "px"?
For example, I want to get information about margin top and it will return is n+'px' (ex. "125px"), but I don't need this number with 'px', is it possible?
6 odpowiedzi
+ 3
you can try with square.offsetTop property of an object or square.getBoundingClientRect()
+ 2
var n = square.style.marginTop;
+ 2
you can try parseFloat()
parseFloat("125px") -> 125
+ 1
cold you provide some code - how you get margin top ?
+ 1
okay, thank you
+ 1
Okay