/ Published in: jQuery

Basic skeleton for a plugin. Contains an example to show where code needs to go.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
(function($){ $.fn.pluginName = function(params){ // give the options their default value options = $.extend({ option1: 'default text' // example option (delete) }, params); // plugin actions. Most code should go here. this.each(function(){ $(this).fadeOut('slow', function(){ $(this).html(options.option1).fadeIn() }); //example action (delete and replace with your code) }); return this; // keeps jquery chaining going } })(jQuery); $('p').pluginName({option1:'new text'}); // call the plugin, pass it the options
Comments
