1
我想知道为什么position: sticky
适用于某些x轴滚动,但是一旦滚动超过屏幕宽度的初始宽度,您的'sticky div'将停止粘贴。当css位置sticky停止粘贴
在这个例子中,我有一个左侧的酒吧,左侧粘贴(请注意,我不能使用position: fixed
或position: absolute
,因为在我的实际项目中,左侧div和右侧div需要滚动上下沿y轴下来,因此我们只左侧粘)
有一个额外的CSS参数,我可以定义,如
left-sticky-distance=999999%
或类似的东西?
一些测试代码示出当低于
<html>
<body>
<div style='
position:sticky;
z-index:1;
left:0;
width:100px;
height:200px;
overflow: hidden;
background-color:#ff0000;
opacity:0.8;
>
</div>
<div style='position:absolute; top:10;left:10; width:200; height:50px; background-color: blue'>B</div>
<div style='position:absolute; top:10;left:110; width:200; height:50px; background-color: blue'>C</div>
<div style='position:absolute; top:10;left:210; width:200; height:50px; background-color: blue'>D</div>
</body>
<html>
请您创建一个小提琴什么的? –