Base jQuery plugin state
/*
* Plugin
*/
(function($) {
$.fn.myPlugin = function(options) {
// set default settings
var settings = $.extend({
color : 'yellow',
backgroundColor: '#000'
}, options);
// plugin body
this.css({
color : settings.color,
backgroundColor: settings.backgroundColor
});
return(this);
};
})(jQuery);
/*
* Usage example
*/
$('a').myPlugin({
color: '#000',
backgroundColor: 'lime'
});