Scroll events not triggered once modal window opened
wazzzzza opened this issue · comments
Cyril S commented
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
Cyril S commented
Solution found.
Applied the fix from @imoddesign:
afterClose: function() {
$('body').removeAttr('style');
}
On close, overflow=auto causes problems
Thanks