JSFiddle - React, Tailwind, and code Playground
by Marventus
HTML
<div>
<button>
Remove Log
</button>
</div>
CSS
body {
background: #ccc;
height: 2000px;
width: 200px;
}
button {
position: fixed;
left: 10px;
top: 10px;
}
JavaScript
$(window).on("scroll.myScroll", function() {
console.log($(this).scrollTop());
});
$(document).ready(function(){
$("button").on("click", function(){
$(window).off("scroll.myScroll");
});
});