imakewebthings / waypoints

Waypoints is a library that makes it easy to execute a function whenever you scroll to an element.
http://imakewebthings.com/waypoints/
10.38k stars 1.33k forks source link

overrides window.onload event handlers attached using jQuery or window.addEventListener #619

Open jrevillini opened 3 years ago

jrevillini commented 3 years ago

The code as written now assumes that either

But if someone used jQuery to add a handler i.e. jQuery( function( $ ) { $( window ).load( function () { ... } ); } );

or they used vanilla JS i.e. window.addEventListener( 'load', function () { ... } );

then it's going to overwrite those handlers and they'll never run.

For more info about how to attach event handlers/listeners, see https://stackoverflow.com/a/30915025/8524018