Skip to content

Instantly share code, notes, and snippets.

@vladimir-s-snippets
Created October 18, 2012 11:55
Show Gist options
  • Save vladimir-s-snippets/3911349 to your computer and use it in GitHub Desktop.
Save vladimir-s-snippets/3911349 to your computer and use it in GitHub Desktop.
JavaScript: jQuery: plugin template
(function($) {
$.fn.<PLUGIN_NAME> = function(settings) {
//default values
var config = {
};
//using user defined values
if (settings) $.extend(config, settings);
//single element
// var element = this;
// iterate over matched elements
return this.each(function() {
// implementations
});
};
// public functions definition
$.fn.pluginName.functionName = function(foo) {
return this;
};
// private functions definition
function foobar() {}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment