Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.56 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Rock-solid jQuery plugin template?
  2. base.functionName = function() {
  3.     ....
  4. }
  5.        
  6. (function($){
  7. $.fn.extend(
  8. {
  9.     //plugin name here
  10.     functionName: function(options)
  11.     {
  12.  
  13.         //Settings list and the default values
  14.         var defaults =
  15.         {
  16.            defaultvar1: "value",
  17.            defaultvar2: "value"
  18.         };
  19.  
  20.         var options = $.extend(defaults, options);
  21.  
  22.         return this.each(function()
  23.         {
  24.             var o =options;
  25.             var obj = $(this);            
  26.             //do stuff here
  27.             }
  28.     });
  29. })(jQuery);