There's a div
(brown rectangle) on the page. The page is higher than the viewport (orange rectangle) so it can be scrolled, which means that the div
might only partially show up or not at all.
What's the simplest algorithm to tell how much % of the div
is visible in the viewport?
(To make things easier, the div
always fits into the viewport horizontally, so only the Y axis needs to be considered at the calculations.)