JSFiddle - React, Tailwind, and code Playground
HTML
<div class="scroll">
<div class="scrolled"> </div>
</div>
CSS
.scroll{
overflow:auto;
background: red;
width: 500px;
height: 200px;
overflow: auto;
}
.scrolled{
height: 5000px;
}
JavaScript
/*
Ako pri scrollingu volat funkciu scrollAlert iba raz.
*/
function scrollAlert(){
alert("Scroll presiahol 100px");
}
$( document ).ready(function() {
var called = false;
$(".scroll").scroll(function() {
if ($(this).scrollTop() < 100 && !called) {
scrollAlert();
called = true;
}
});
});