I’m currently designing the responsive version of a content-heavy b2b website and came across a challenge: How can I determine if a an element (a headline, to be precise) is currently visible in the viewport (“visible” meaning not below the fold, there’s no dynamic behavior regarding the headlines)?
I could of course use the OnScroll event and calculate the y-position, but I’m already using this for other purposes and it would get quite complicated if I had to create further ELSE IFs …
At fist I tried to use the OnShow-event, but this only relates to something being shown/hidden dynamically, and does not relate to the viewport in any way … (I guess, since I couldn’t find a proper documentation for all the events anywhere … )