Posted By

mrb23771 on 11/13/15


Tagged


Versions (?)

jQuery plugin template


 / Published in: jQuery
 

Template for a jQuery plugin

  1. //jquery plugin
  2. (function ( $ ) {
  3.  
  4.  
  5.  
  6. $.fn.plugin = function(options) {
  7.  
  8.  
  9. var settings = $.extend({
  10. // These are the defaults.
  11.  
  12. //options
  13. option: null,
  14.  
  15. //call back functions
  16. onCallback :function() {}
  17.  
  18.  
  19. //Rest of the Settings goes here...
  20. }, options );
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. //----------------------------------------------------------------------
  29. // Public functions
  30. //----------------------------------------------------------------------
  31. this.publicFunction = function(){
  32.  
  33. };
  34.  
  35.  
  36. //---------------------------------------------------------------------
  37. // private functions
  38. //---------------------------------------------------------------------
  39. function privateFunction (){
  40.  
  41. }
  42.  
  43. return this;
  44.  
  45. };
  46.  
  47.  
  48. }( jQuery ));

Report this snippet  

You need to login to post a comment.