jQuery: Plugin Skeleton
January 18th, 2010 by jeremychoneShould be in file jquery.samplePlugin.js
(function($) {
/**
* Skeleton for jQuery plugin
* @param {Object} options
*/
$.fn.samplePlugin = function(options) {
// extends options with the default one
var opts = $.extend({}, $.fn.samplePlugin.defaults, options);
// iterate and process each matched element
return this.each(function() {
var $this = $(this); // jQuery object for this element
//do what is needed
});
};
// samplePlugin default options
$.fn.samplePlugin.defaults = {};
})(jQuery);