scrollX, scrollY, pageXOffset, pageYOffset now return double instead of integer

Published: | Categories: DOM


On Firefox 55 and later, the scrollX and scrollY properties and those aliases pageXOffset and pageYOffset on window will return a double with sub-pixel precision, just like values returned by the getBoundingClientRect method. If necessary, use the Math.round method to cast those to traditional integer values.