Image slider plugin: simulating a click on window load does not work after updating the jQuery library
I am building an image slider plugin with Next and Previous buttons and an auto advance feature.
The auto advance happens by triggering clicks on the Next button at equal intervals:
- $(window).on('load', function() {
- autoAdvanceInterval = setInterval(function() {
- $('#next').trigger('click');
- }, settings.pause);
- // When a control or dot is clicked by user
- // stop autoadvance by clearInterval method
- $('.controls a,.bullets li').click(function(event) {
- if (event.originalEvent !== undefined) {
- clearInterval(autoAdvanceInterval);
- }
- });
- });
The auto advance stooped working after updating jQuery from v2.0.0 to v3.2.1. I replaced $(window).load()
with (window).on('load', ...
but it still does not work.
What am I doing wrong? Thank you!