/ Published in: jQuery
Following these docs: http://docs.jquery.com/Plugins/Authoring
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
(function($){ var environment = {}; var methods = { init:function(options) { var options = $.extend({}, options); return this.each(function() { }); } }; $.fn.pluginName = function(method){ if ( methods[method] ) { return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); } else if ( typeof method === 'object' || ! method ) { return methods.init.apply( this, arguments ); } else { $.error( 'Method ' + method + ' does not exist on jQuery.pluginName' ); } }; })(jQuery);