简体   繁体   English

固定的背景图像在固定位置滚动时跳转 <video> 在页面上

[英]Fixed background images jump when scrolling with a position fixed <video> on the page

I've come across a strange problem and have no idea how to fix it. 我遇到了一个奇怪的问题,不知道如何解决。 See the example: 参见示例:

http://jsfiddle.net/9wqsr/1/ http://jsfiddle.net/9wqsr/1/

I have 3 divs and a video element. 我有3个div和一个video元素。 The video is position:fixed at the top of the page so the 3 divs scroll over it. 视频位置:固定在页面顶部,因此3个div滚动到该位置。 The first has a solid colour background, the second has no background so the video is revealed when it scrolls over. 第一个具有纯色背景,第二个没有背景,因此视频在滚动时会显示出来。 The third has a background image that is fixed in it's position. 第三个具有固定在其位置的背景图像。

Here's the problem: when the 3rd div with the background image reaches the video, the "fixed" background image suddenly jumps. 问题在于:当带有背景图片的第3个div到达视频时,“固定”背景图片突然跳了起来。

This happens in the latest versions of Chrome and Safari but not Firefox. 在最新版本的Chrome和Safari中会发生这种情况,但在Firefox中却不会。

Any idea what's going on and how to solve? 知道发生了什么事以及如何解决吗?

尝试不带“固定”的背景图片。

 background: yellow url(http://jsfiddle.net/img/top-bg.png) 10px 0 repeat;

尝试使用z-index:-1的背景;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM