improving cross-browser scroll height check

Implemented changes recommended in https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect for checking scroll height.

There's still a bug with height checks but it's sort of working.