Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Possible to toggle a div display based on what is currently viewable on screen? Reply To: Possible to toggle a div display based on what is currently viewable on screen?

#158393
Merri
Participant

Probably the only way you can do it in CSS only: http://codepen.io/Merri/pen/pAmce

So you work with z-index to hide the fixed element behind scrolling elements.

If you want to get different behavior then JavaScript is the only way. CSS provides no mechanism to know scrolling position or if element is viewable on the screen/viewport.