Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4. <style>
  5. body {
  6. min-height: 5000px;
  7. }
  8. </style>
  9. <h2>JavaScript addEventListener()</h2>
  10.  
  11. <p>This example uses the addEventListener() method to attach a click event to a button.</p>
  12.  
  13. <button id="myBtn">Try it</button>
  14.  
  15. <p id="demo"></p>
  16.  
  17. <script>
  18. window.onscroll = function() {
  19. console.log('onscroll')
  20. }
  21. window.addEventListener('scroll', function(e) {
  22. console.log('scroll 1');
  23. });
  24. window.addEventListener('scroll', function(e) {
  25. console.log('scroll 2');
  26. });
  27. window.addEventListener('scroll', function(e) {
  28. console.log('scroll 3');
  29. });
  30. </script>
  31.  
  32. </body>
  33. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement