Skip to content

Instantly share code, notes, and snippets.

@carloscabo
Forked from afgomez/jquery.fn.js
Created June 11, 2013 14:59
Show Gist options
  • Save carloscabo/5757581 to your computer and use it in GitHub Desktop.
Save carloscabo/5757581 to your computer and use it in GitHub Desktop.
Generic JQuery plugin template
(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