Skip to content

Instantly share code, notes, and snippets.

@afgomez
Created June 11, 2013 14:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save afgomez/5757546 to your computer and use it in GitHub Desktop.
Save afgomez/5757546 to your computer and use it in GitHub Desktop.
quick template for jQuery plugins
(function($) {
$.fn.plugin = function() {
return this.each(function() {
var $this = $( this );
if ( !$this.data('plugin') ) {
$this.data( 'plugin', new Plugin(this) );
}
});
}
Plugin = function() { ... }
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment