我很难将这两者合并到同一个项目中。
如果我启用了overflow: scroll,那么我的jQuery函数就不会被调用,但是如果我禁用它,那么我的jQuery就可以工作了,但是滚动捕捉就不能工作了。
我试着在jQuery .scroll()中将"window“改为"#scroll-parent”,但没有任何效果。
$(window).scroll(function() {
setMenuColor();
});body {
font-family: "Montserrat";
background: #000;
margin: 0px;
overflow-x: hidden;
}
#scroll-parent {
//overflow: scroll;
height: 100vh;
scroll-snap-type: mandatory;
scroll-snap-points-y: repeat(100vh);
scroll-snap-type: y mandatory;
-webkit-overflow-scrolling: touch;
}<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
发布于 2020-03-14 18:50:45
#scroll-parent DIV在HTML中的位置不正确
https://stackoverflow.com/questions/60674944
复制相似问题