emjayess
1/18/2011 - 11:34 PM

boilerplate js for jquery plugin authoring

boilerplate js for jquery plugin authoring

// replace 'foo' with the name of the plugin, etc
(function($){
  $.fn.foo = function(opts) {
    var settings = $.extend({}, $.fn.foo.defaults, opts);

    return this.each(function() {
      var $this = $(this);
      // plugin code here...
    });
  };

  $.fn.foo.defaults = {
    bar : "baz"
  };
}(jQuery));