滚动时如何阻止图像向下移动?

时间:2022-06-16 19:40:41

I have created a header image of about half a page. When user scroll down the images goes down with scrolling as well. I want the image to go up and hide and does not effect the content beneath it. I have checked many single page websites websites where images are on some place and when scrolling they goes up and down with scrolling and does not effect the other things.

我创建了大约半页的标题图像。当用户向下滚动时,图像也会随着滚动而下降。我希望图像上升并隐藏,不会影响其下方的内容。我检查了许多单页网站网站,其中图像在某些地方,滚动时,它们上下滚动,不影响其他东西。

I tried to use position:fixed but it didn't work, position:relative is also effecting the content beneath it.

我尝试使用position:fixed但它不起作用,position:relative也影响它下面的内容。

Example of what i want : http://www.piedpiper.com/

我想要的例子:http://www.piedpiper.com/

Kindly tell me how to do this.

请告诉我如何做到这一点。

1 个解决方案

#1


0  

Set position:fixed for parent element of image.

设置位置:固定为图像的父元素。

#1


0  

Set position:fixed for parent element of image.

设置位置:固定为图像的父元素。