html - How can I make fixed elements visible ONLY when their parent elements are visible? -
the site i'm working on has several div
sections each width , height of viewport. stacked vertically, each relative positioning (see codepen). inside each element fixed-position h1
. i'd fixed h1
in each element remain visible when respective parent visible.
i've tried number of z-index experiments no success. ideas on try next?
since fixed position element located in viewport , not dom. meaning need manipulate html tag making pretty impossible.
two options though, first being change position absolute (with adjustments position being based off closet parent position of relative, absolute, fixed or dom root) , hide appropriate parent element.
second option hide , show fixed element using favorite js library respond user interaction instead of wrapping it.
Comments
Post a Comment