简体   繁体   中英

Scroll Stop event in Javascript

I am struct at one point basically i am trying developing IOS (Cordova) application with core javascript without using any framework like ionic,onsen ui etc Problem is that i want scroll stop event when scrolling stop

process :-

When user hit for scroll then scrolling start after sometime scrolling will stop I need scroll stop when scrolling stop.. (need in core javascript without any external JS like J query etc)

Thanks If anyone can help me out from this

<script language="javascript">
  var scrollTimer = -1;

    function bodyScroll() {
     document.getElementById("#test") = "scrolling";

    if (scrollTimer != -1)
    {
     clearTimeout(scrollTimer);
     scrollTimer = window.setTimeout("scrollFinished()", 500);
    }

    function scrollFinished() {
    document.getElementById("#test") = "scrolling stopped";
   }
</script>
<body onscroll="bodyScroll();">
  <div id="test"></div>
</body>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM