I want to execute a command in using jquery when a certain div (we'll call it div2) is being scrolled. This would be no problem except div2 is contained within another div (div1), and div1 has its height set to 100vh and its overflow set to scroll. In other words, jquery does not recognize anything as actually being scrolled as far as I can tell. When I tell jquery to perform the function when the whole window is scrolled, nothing happens, when I tell it to perform the function when div1 is being scrolled, nothing happens. When I tell it to perform the function when div2 is being scrolled, obviously nothing happens. How can I communicate that div1 is being scrolled in order to perform my function? Below is what I've tried so far. Any help would be greatly appreciated. Thank you in advance!
$(window).scroll(function(){
var wScroll = $(this).scrollTop();
alert("Hello");
});
.div1{
height:100vh;
overflow: scroll;
background: red;
}
.div2 {
height: 5000px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="div1">
<div class="div2">
</div>
</div>