Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. const modalLayer = document.querySelector('.modal-layer');
  2. const modal = document.querySelector('.modal');
  3. modal.addEventListener('modalopen', () => {
  4. document.body.style.overflow = 'hidden';
  5. });
  6. modal.addEventListener('modalclose', () => {
  7. document.body.style.overflow = 'auto';
  8. });
  9.  
  10. // method 2
  11. // modalLayer.addEventListener('scroll', (e) => {
  12. // e.preventDefault();
  13. // })
  14. // for pc
  15. // modalLayer.addEventListener('wheel', (e) => {
  16. // e.preventDefault();
  17. // })
  18. // modal.addEventListener('wheel', (e) => {
  19. // // if (!((e.deltaY > 0 && modal.clientHeight + modal.scrollTop === modal.scrollHeight)
  20. // // || (e.deltaY < 0 && modal.scrollTop === 0))
  21. // // ) {
  22. // if ((e.deltaY < 0 || modal.clientHeight + modal.scrollTop !== modal.scrollHeight)
  23. // && (e.deltaY > 0 || modal.scrollTop !== 0)
  24. // ) {
  25. // e.stopPropagation();
  26. // }
  27. // })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement