Created
June 13, 2013 05:04
-
-
Save tyaslab/5771361 to your computer and use it in GitHub Desktop.
jQuery Plugin Kickstarter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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