Fractional scrollHeight?

https://developer.mozilla.org/en-US/docs/Web/API/element.scrollHeight?redirectlocale=en-US&redirectslug=DOM%2Felement.scrollHeight :

"This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect()."

Except ... "element.getBoundingClientRect ()" does not return scrollHeight. How to get fractional scroll? Is it possible?

+4
source share
1 answer

I think I might have a solution:

var rect = element.getBoundingClientRect()
var scrollHeight = element.scrollHeight + (parseInt(rect.height) - rect.height)
var scrollWidth  = element.scrollWidth  + (parseInt(rect.width)  - rect.width)
+3
source

Source: https://habr.com/ru/post/1526083/


All Articles