Skip to content

Instantly share code, notes, and snippets.

@Rafailong
Created December 6, 2012 05:37
Show Gist options
  • Save Rafailong/4222035 to your computer and use it in GitHub Desktop.
Save Rafailong/4222035 to your computer and use it in GitHub Desktop.
jQuery plugin template.
(function ($) {
$.fn.pluginName = function (options) {
if (this.length > 1) {
this.each(function () { $(this).pluginName(options); });
return this;
}
/*
private variables
var x = ...
*/
var init = function () {
// init actions.
return this;
};
/*
private function
var func = function ....
*/
/*
public functions
this.public= function ....
*/
return this.init();
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment