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?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #158387
    paddypatpat
    Participant

    Hi there,

    Blind shot in the dark here.

    I’d like to display a fixed div based on if another element is scrolled into view. Just to state that another way, the fixed di should not be seen until a particular element that is some unknown distance down the page is scrolled into the viewable area of the user’s window.

    Is this possible?
    Am I in the right forum for it?

    Thanks for any suggestions!

    Patrick

    #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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.