Skip to content

Instantly share code, notes, and snippets.

@benhuson
Created April 8, 2015 20:54
Show Gist options
  • Save benhuson/12f4429c853d46ba33f9 to your computer and use it in GitHub Desktop.
Save benhuson/12f4429c853d46ba33f9 to your computer and use it in GitHub Desktop.
jQuery Plugin Starter Template
( function( $ ) {
$.fn.helloWorld = function( options ) {
// Establish our default settings
var settings = $.extend( {
text : 'Hello, World!',
color : null,
fontStyle : null,
complete : null
}, options );
return this.each( function() {
$( this ).text( settings.text );
if ( settings.color ) {
$( this ).css( 'color', settings.color );
}
if ( settings.fontStyle ) {
$( this ).css( 'font-style', settings.fontStyle );
}
if ( $.isFunction( settings.complete ) ) {
settings.complete.call( this );
}
} );
}
} ( jQuery ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment