我在我的网站上包含了一个全屏视频背景,其中包含以下代码
<video id="video_background" preload="auto" autoplay="true" loop="loop" muted volume="0">
<source src="inc/img/back.webm" type="video/webm" />
<source src="inc/img/back.mp4" type="video/mp4" />
</video>
和 CSS
#video_background {
position: absolute;
bottom: 0px;
right: 0px;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -1000;
overflow: hidden;
background-attachment: fixed;
}
这工作正常,但背景不是“固定的”。因此,当您必须滚动页面时,视频仅显示在顶部,而在下方您只会看到黑色(或其他任何内容)。是否有解决方法,或者我必须使用视频背景插件而不仅仅是 html5?