Skip to content

Instantly share code, notes, and snippets.

@lotsofcode
Created April 26, 2012 22:27
Show Gist options
  • Select an option

  • Save lotsofcode/2503723 to your computer and use it in GitHub Desktop.

Select an option

Save lotsofcode/2503723 to your computer and use it in GitHub Desktop.
jQuery Boilerplate
;(function($, undefined) {
$.REPLACE_PLUGIN_NAME = function(element, options) {
var defaults = {}
var plugin = this;
plugin.settings = {}
var $element = $(element), element = element;
plugin.init = function() {
plugin.settings = $.extend({}, defaults, options);
private_method()
plugin.public_method()
}
plugin.init();
var private_method = function() {}
plugin.public_method = function() {}
}
$.fn.REPLACE_PLUGIN_NAME = function(options) {
return this.each(function() {
if (undefined == $(this).data('REPLACE_PLUGIN_NAME')) {
var plugin = new $.REPLACE_PLUGIN_NAME(this, options);
$(this).data('REPLACE_PLUGIN_NAME', plugin);
}
});
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment