【发布时间】:2016-07-20 07:38:52
【问题描述】:
我有 2 个 DIV(1 和 2)都是 100% 宽度、100% 高度和位置:绝对,我想要实现的是当用户查看 DIV 1 并向下滚动大约 10% 时,DIV 2自动滚动以适应屏幕。
这里是示例代码https://jsfiddle.net/d6bpr5o2/
<div id="one" class="content">
when user scroll like 10% down. the screen automatically scroll to the next div.
</div>
<div id="two" class="content">
this is second screen
</div>
这是 CSS:
.content{
position:absolute;
width:100%;
height:100%;
left:0;
top:0;
}
#one{
background:blue;
}
#two{
top:100%;
background:rgba(255,255,0,1.00);
}
【问题讨论】:
-
请添加您的代码
-
Fiddle 可以很好地解决这个问题。
-
图像非常好。但是你的代码在哪里?
-
您的图片与您描述的情况不符。您图像中的 div 似乎具有静态或相对位置,而不是绝对位置(从外观上看)。