Forums

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

Home Forums CSS Hiding page content under fixed div

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

    https://jsfiddle.net/k3tof2js/

    In the example posted above, I want the page content div to hide once it reaches the fixed-positioned orange div. In other words, I want the page content div to scroll into the fixed div; not let the content scroll past the fixed div. As you can see the page content div remains visible when I scroll.

    #256357
    Beverleyh
    Participant

    Im not sure what you want to happen to the content box once it hits the orange header (display:none; for content doesn’t seem right to me), but have a look at the JavaScript in this article http://blog.fofwebdesign.co.uk/41-add-classes-to-an-element-when-scrolled-into-viewport

    You can use it to apply a new class to the content box when it reaches the header (150px from top should do it; a combined total of the header’s height and margin-top). Then, define new styles against the new class so that the content box does whatever you want.

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