Return to Snippet

Revision: 52487
at October 25, 2011 01:41 by lawlesscreation


Initial Code
;(function ( $, window, document, undefined ) {
    
    var pluginName = 'defaultPluginName',
        defaults = {
            propertyName: "value"
        };

    function Plugin( element, options ) {
        this.element = element;
        this.options = $.extend( {}, defaults, options) ;
 
        this._defaults = defaults;
        this._name = pluginName;
        
        this.init();
    }

    Plugin.prototype.init = function () {
        // code goes here
    };

    $.fn[pluginName] = function ( options ) {
        return this.each(function () {
            if (!$.data(this, 'plugin_' + pluginName)) {
                $.data(this, 'plugin_' + pluginName, new Plugin( this, options ));
            }
        });
    }

})(jQuery, window, document);

Initial URL
http://jqueryboilerplate.com/

Initial Description
https://github.com/zenorocha/jquery-boilerplate/blob/master/jquery.boilerplate.min.js

Initial Title
jQuery boilerplate

Initial Tags
plugin, jquery

Initial Language
jQuery