jQuery v3.2.1: Uncaught TypeError: a.indexOf is not a function at r.fn.init.r.fn.load

jQuery v3.2.1: Uncaught TypeError: a.indexOf is not a function at r.fn.init.r.fn.load

I had made a plugin a while ago, it used jQuery v2.1.1. It worked fine. Since using the modern 3.2.1, the console shows this error:


Uncaught TypeError: a.indexOf is not a function at r.fn.init.r.fn.load


I have a piece of code like this:

  1. function responsiveSlides() {
  2.        var percentageSlidesWidth = (1 / slidesLen) * 100 + '%';
  3.        $slides.width(percentageSlidesWidth);
  4. }
  5. $(window).on('load',responsiveSlides());

The last line above seems to cause the error. But what is the fix? Thank you!