joaopereirawd / animatedModal.js

animatedModal.js is a jQuery plugin to create a fullscreen modal with CSS3 transitions. You can use the transitions from animate.css or create your own transitions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scroll events not triggered once modal window opened

wazzzzza opened this issue · comments

Hi,

I have a scroll event listener which works fine until a modal is opened.
Once it is launched, the listener doesn't trigger any scroll event anymore.
I tried removing the listener on beforeOpen and adding it again on beforeClose but it didn't fix the issue:

$("#modal01").animatedModal({color:"rgba(0, 0, 0, 0.8)", beforeOpen: function() { window.removeEventListener('scroll', checkScrollY, false);  }, afterClose: function() { window.addEventListener('scroll', checkScrollY, false);  } });

function checkScrollY(){
  console.log(window.scrollY);
}

Would you have any idea?

Cheers

Solution found.

Applied the fix from @imoddesign:

afterClose: function() {
  $('body').removeAttr('style');
}

On close, overflow=auto causes problems

Thanks