By defining the variables outside the callback, their value will persist between the callbacks, and be updated from within the callback to more accurately detect when the modal was opened. This should fix the issue with some themes where the user either couldn't scroll up or the window kept scrolling up when the used tried to scroll down.
By defining the variables outside the callback, their value will persist between the callbacks, and be updated from within the callback to more accurately detect when the modal was opened. This should fix the issue with some themes where the user either couldn't scroll up or the window kept scrolling up when the used tried to scroll down.
Tested on Storefront and Porto themes.