2. /* this code goes in pluginName.js */ (function($){ $.fn. pluginName = function(options) { this.each(function() { /* do code here*/ } }; })(jQuery); /* this code goes in the html document */ $(selector) . pluginName(); The base (what is this?)
3. (function($){ $.fn. pluginName = function(options) { this.each(function() { /* do code here*/ } }; })(jQuery); $(selector) . pluginName(); The base Here we can assign the name at our plugin In the plugin file
4. (function($){ $.fn. pluginName = function(options) { this.each(function() { /* do code here*/ } }; })(jQuery); $(selector) . pluginName(); The base And we can call it In the web page
6. What the plugin has to do? $(this) .animate({'opacity':'0.2'},300) .animate({'opacity':'1.0'},300) .animate({'opacity':'0.2'},300) .animate({'opacity':'1.0'},300) .animate({'opacity':'0.2'},300) .animate({'opacity':'1.0'},300);
16. $(selector).pulseEffect(); We can use pulseEffect () with no parameters. But we have to tell our plugin to set all parameters as a default values.
17. $(selector).pulseEffect(); /* d stands for default (value) */ d = { 'times':2, 'startOp':0.3, 'endOp':1.0, 'delay':300 }; /* o stands for options */ o = (options==undefined)?d:options;