JavaScript Tutorial

.scroll()

<!DOCTYPE html>
<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <script>
            var x = 0;
            $(document).ready(function(){
              $("div").scroll(function(){
                $("span").text( x+= 1);
              });
            });
        </script>
    </head>
<body>
<p>Try the scrollbar in the div</p>
<div style="border:1px solid black;width:200px;height:100px;overflow:scroll;">
    Inimist Technologies is a Web Design & Development company located in Mohali, Chandigarh area. We offer various types of IT services and web consultancy. We majorly work in Web & Mobile App Development, Search Engine ServicesInimist Technologies is a Web Design & Development company located in Mohali, Chandigarh area. We offer various types of IT services and web consultancy. We majorly work in Web & Mobile App Development, Search Engine ServicesInimist Technologies is a Web Design & Development company located in Mohali, Chandigarh area. We offer various types of IT services and web consultancy. We majorly work in Web & Mobile App Development, Search Engine Services
</div>
<p>Scrolled <span>0</span> times.</p>
</body>
</html>