我的网页的移动版有问题。正如你在下面的代码中看到的,我将这两个div设置为在网页加载时占据100%的视窗高度。它在台式机上运行完美,但在移动设备(或者至少我的手机--我有一部三星Galaxy S5)上,屏幕似乎会跳跃,因为三星互联网有一个菜单,当你向下滚动一点时,它就会折叠。这会导致我的两个div自动填充新的可用视口空间,因此出现“跳转”。
我的问题是,有没有人知道如何在两个div更改之前将其锁定到初始视区高度?
#welcome-section{
top: 0;
color: white;
height: 94vh;
background-image: var(--stars-background);
background-size: 1080px 960px;
}
#navbar {
z-index: 3;
background-color: black;
margin: 0;
padding: 0;
top: 0;
width: 100%;
height: 6vh;
position: -webkit-sticky;
position: sticky;
}https://stackoverflow.com/questions/51392717
复制相似问题