I'm facing challenges in integrating both of these elements into the same project.
When I activate overflow: scroll
, my jQuery function does not work as expected. However, if I deactivate it, then the jQuery works but the scroll-snap feature does not.
I attempted to modify the jQuery code from using "window" to "#scroll-parent" with the .scroll()
method, but it did not yield any results.
$(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>