Skip to content

Instantly share code, notes, and snippets.

@Wurren
Last active October 2, 2015 20:08
Show Gist options
  • Save Wurren/2310895 to your computer and use it in GitHub Desktop.
Save Wurren/2310895 to your computer and use it in GitHub Desktop.
Jquery Plugin Boilerplate
;(function ( $, window, document, undefined ) {
var pluginName = '',
document = window.document,
defaults ={};
function Plugin( element, options ) {
this.element = element;
this.options = $.extend( {}, defaults, options) ;
this.init();
}
Plugin.prototype = {
init : function() {}
};
$.fn[pluginName] = function ( options ) {
return this.each(function () {
if (!$.data(this, 'plugin_' + pluginName)) $.data(this, 'plugin_' + pluginName, new Plugin( this, options ));
});
};
}(jQuery, window, document));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment