Created
August 10, 2011 22:33
-
-
Save jaubourg/1138463 to your computer and use it in GitHub Desktop.
jQuery boilerplate suggestion
This file contains hidden or 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
// remember to change every instance of "pluginName" to the name of your plugin! | |
// the semicolon at the beginning is there on purpose in order to protect the integrity of your scripts when | |
// mixed with incomplete objects, arrays, etc. | |
;(function( $ ) { | |
// plugin's default options | |
// this is private property and is accessible only from inside the plugin | |
var defaults = { | |
propertyName : 'value' | |
}; | |
$.fn.pluginName = function( options ) { | |
// lets merge options with default settings | |
options = $.extend( {}, defaults, options ); | |
// maintaining chainability | |
return this.each(function() { | |
var $this = $( this ); | |
// your code here | |
}); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment