Recently, I encountered an issue with a Wordpress plugin that displays popups on scroll. The code I currently have is as follows:
jQuery(window).scroll(function(){
//display popup
});
The problem arises with a particular website that has specific CSS rules in place:
html, body {
overflow: hidden;
}
div#pageWrap {
overflow: scroll;
-webkit-overflow-scrolling: touch;
}
Due to these CSS rules, the scroll event is not triggering on the window, causing the popup not to work. In such cases, should I set the scroll event on the #pageWrap div instead of the window because the scroll event doesn't propagate as expected:
jQuery("#pageWrap").scroll(function(){
//display popup
});
My main concern is whether it's possible to handle this dynamically. It's not feasible for me to modify the plugin's code for each site facing this issue. Is there a way to make the scroll event propagate or establish a fallback solution? Any insights or suggestions on how to tackle this would greatly appreciated.