Convert pixels to number js 1

Convert pixels to number js

parseInt(MyPixelsString, 10);

sauce : https://stackoverflow.com/questions/3024084/jquery-javascript-how-do-i-convert-a-pixel-value-20px-to-a-number-value-2

Here is what the above code is Doing:
1. We’re using the .css() method to get the value of the “top” property of the #box element.
2. We’re using the .replace() method to remove the “px” from the end of the value.
3. We’re using the .parseInt() method to convert the string value to an integer.

Similar Posts