Skip to content

Instantly share code, notes, and snippets.

@jjasonclark
Created November 29, 2013 05:34
Show Gist options
  • Save jjasonclark/7701980 to your computer and use it in GitHub Desktop.
Save jjasonclark/7701980 to your computer and use it in GitHub Desktop.
;(function($, window, document, undefined) {
var pluginName = "name me":
$.fn[pluginName] = function (method) {
var dataName = "plugin_" + pluginName;
return this.each(function() {
var localData = $.data(this, dataName);
if (undefined === $.data(this, dataName)) {
var options = $.extend({}, $.fn[pluginName]["defaults"], method);
$.data(this, dataName, plugin(this, options));
} else {
localData.methods[method]();
};
});
};
$.fn[pluginName]["defaults"] = {
};
function plugin(element, settings) {
var private_vars = "here";
function private_functions_here() {
};
return {
methods: {
public_function: private_functions_here
}
};
};
})(jQuery, window, document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment