Skip to content

Instantly share code, notes, and snippets.

@salcode
Created November 7, 2013 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salcode/7354716 to your computer and use it in GitHub Desktop.
Save salcode/7354716 to your computer and use it in GitHub Desktop.
My starter template for a jQuery plugin
/*
* jQuery('a').pluginName();
* or
* jQuery('a').pluginName({
* className: 'alternative-class-name'
* });
*/
;(function ( $, window, document ) {
$.fn.pluginName = function( options ) {
var settings = $.extend({
className: 'example-class-name'
}, options );
return this.each( function() {
$(this).addClass( settings.className );
});
};
})( jQuery, window, document );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment