Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const modalLayer = document.querySelector('.modal-layer');
- const modal = document.querySelector('.modal');
- modal.addEventListener('modalopen', () => {
- document.body.style.overflow = 'hidden';
- });
- modal.addEventListener('modalclose', () => {
- document.body.style.overflow = 'auto';
- });
- // method 2
- // modalLayer.addEventListener('scroll', (e) => {
- // e.preventDefault();
- // })
- // for pc
- // modalLayer.addEventListener('wheel', (e) => {
- // e.preventDefault();
- // })
- // modal.addEventListener('wheel', (e) => {
- // // if (!((e.deltaY > 0 && modal.clientHeight + modal.scrollTop === modal.scrollHeight)
- // // || (e.deltaY < 0 && modal.scrollTop === 0))
- // // ) {
- // if ((e.deltaY < 0 || modal.clientHeight + modal.scrollTop !== modal.scrollHeight)
- // && (e.deltaY > 0 || modal.scrollTop !== 0)
- // ) {
- // e.stopPropagation();
- // }
- // })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement