Skip to content

Instantly share code, notes, and snippets.

@tyaslab
Created June 13, 2013 05:04
Show Gist options
  • Save tyaslab/5771361 to your computer and use it in GitHub Desktop.
Save tyaslab/5771361 to your computer and use it in GitHub Desktop.
jQuery Plugin Kickstarter
/*
* BLANK jQuery Plugin
*/
(function($) {
// replace pluginName to yours
$.fn.pluginName = function(opts) {
// extends default options to that of user-defined
var options = $.extend({}, $.fn.pluginName.defaults, opts);
// selector
var $$ = $(this);
$$.each(function(key, value) {
// Do what you want to do for each selector
});
if ($$.length) {
// After "each" job finished, you might want to do extra
};
};
// public method example
$.pluginName = function(an_arg) {
alert(an_arg);
}
$.fn.pluginName.defaults = {
// your default values here
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment