Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <style>
- body {
- min-height: 5000px;
- }
- </style>
- <h2>JavaScript addEventListener()</h2>
- <p>This example uses the addEventListener() method to attach a click event to a button.</p>
- <button id="myBtn">Try it</button>
- <p id="demo"></p>
- <script>
- window.onscroll = function() {
- console.log('onscroll')
- }
- window.addEventListener('scroll', function(e) {
- console.log('scroll 1');
- });
- window.addEventListener('scroll', function(e) {
- console.log('scroll 2');
- });
- window.addEventListener('scroll', function(e) {
- console.log('scroll 3');
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement