Closed fchaussin closed 6 years ago
I do like your idea, but may I suggest to go even further and listen for “first user interaction”?
That means adding the same listener to keydown
, mousedown
, mousemove
and touchstart
. When any of those events occur the listener removes itself from all of those events, similar to your mousemoveFunction
.
Even better!
In the same time it would be great to find a way to execute firstUserInteraction when the document is fully rendered. I've tested my edit in a bad way, and it is totally useless if the firstUserInteraction is early fired.
Is there a way to trigger the check() function from an external script?
I have merged the changes and will publish a new version in the WordPress SVN soon. Thank you!
I was happy this afternoon when I've seen seen this changelog on the plugin update :+1: Thank you for this awesome plugin!
Adding 'mousemove' event listener to be executed once. Why? When I use a masony plugin gallery, it can take a while for the page to be fully loaded, and some images in the viewport are not loaded. By adding this event, it fire the 'check' function when the user move the cursor over the body. I've wrapped the listener in a separeted function to be executed once.