I’ve found this template for creating jQuery plugin http://stefangabos.ro/jquery/jquery-plugin-boilerplate-revisited/
But I don’t understand in code, why we declare pluginName like a method of jQuery object and then we declare pluginName like a method of object $.fn why we did that?
Adding the plugin to
$enables you to write:Adding the plugin to
$.fnenables you to write: