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.)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…