Created
April 8, 2015 20:54
-
-
Save benhuson/12f4429c853d46ba33f9 to your computer and use it in GitHub Desktop.
jQuery Plugin Starter Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( 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