JSFiddle - React, Tailwind, and code Playground

HTML

<div></div>
<div></div>
<div></div>

CSS

body { height: 2000px; }

JavaScript

(function($, window, undefined){

    $.fn.myPlugin = function() {

        $(window).scroll(function(){
            console.log('scroll');
        });

        this.each(function(i, el){
            $(el).addClass('something-' + i);
        });

        return this;
    };

})(jQuery, window);

$('div').myPlugin();

console.log($('div').map(function(){ return this.className; }).get());