JavaScript Tutorial/Window/onscroll

Материал из Web эксперт
Перейти к: навигация, поиск

Use window.onscroll to add the onscroll event handler

<html>
    <head>
        <title>OnScroll Example</title>
        <script type="text/javascript">
            window.onscroll = function () {
                alert("scrolling");
            }
        </script>
    </head>
    <body>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
         <P>Try scrolling this window.</p>
    </body>
</html>