Skip to content

Instantly share code, notes, and snippets.

@gilliek
Created May 1, 2014 10:45
Show Gist options
  • Save gilliek/0f5053d390372355083a to your computer and use it in GitHub Desktop.
Save gilliek/0f5053d390372355083a to your computer and use it in GitHub Desktop.
Just a basic template for jQuery plugins.
/* ========================================================================
* jQuery Plugin Template: <+FILENAME+>.js v<+MAJOR+>.<+MINOR+>.<+PATH+>
* ========================================================================
* Copyright <+YEAR+> <+AUTHOR+>
* Licensed under <+LICENSE+>
* (<+LICENSE_URL+>)
* ======================================================================== */
(function($) {
$.jQueryPluginTemplate = function(element, options) {
var defaults = {
<+OPTIONS+>
}
var plugin = this;
plugin.settings = {}
plugin.init = function() {
plugin.settings = $.extend({}, defaults, options);
}
plugin.init();
}
$.fn.jQueryPluginTemplate = function(options) {
return this.filter("<+TAGS+>").each(function() {
new $.jQueryPluginTemplate(this, options);
}
});
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment