[英]clip a fixed div from a scrolling div underneath
I have a fixed header that I only want to show when it is on top of a specific image. 我有一个固定的标头,当它在特定图像上时,我只想显示它。
As the user scrolls I want the the fixed header to begin to hide as the image scrolls beneath it 当用户滚动时,我希望固定标题在图像滚动到其下方时开始隐藏
<Header
position=fixed
clip-path=url(#clip-stage.id)> Fixed Header RED
</Header>
<Slide
position=absolute
>
<svg
position=absolute
>
<defs>
<clipPath id=clip-stage.id}>
<rect
x=0 y=0 height=100% width=100%
/>
</clipPath>
</defs>
</svg>
</Slide>
** added pseudo css code for reference ** **添加了伪CSS代码以供参考**
I attempted creating a clipPath around every background image which didnt work for me and believe that maybe some overflow trickery could work. 我试图围绕每个背景图像创建一个clipPath,但对我不起作用,并认为也许有些溢出技巧可以起作用。
I would suggest using Bootstrap and build a quick navbar. 我建议使用Bootstrap并建立一个快速导航栏。 You could easily code or copy and paste some JS that would hide the navbar on scroll.
您可以轻松地编码或复制并粘贴一些JS,这些JS将在滚动条上隐藏导航栏。
The css for this would be: 的CSS将是:
display:none;
The point is Bootstrap makes all this and more very easy! 关键是Bootstrap使所有这些事情变得更加容易!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.