Skip to content

Instantly share code, notes, and snippets.

@prbaron
Last active August 29, 2015 14:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prbaron/e8382c85ec520c43f09e to your computer and use it in GitHub Desktop.
Save prbaron/e8382c85ec520c43f09e to your computer and use it in GitHub Desktop.
jQuery plugin template
/**
* new plugin template
*
* to call it $('#myElement').pluginTitle();
*/
(function( $ ){
$.fn.pluginTitle = function(options) {
// get the called element
var $container = $(this);
// default options
var DEFAULTS = {};
// extend user options with the default options
var options = $.extend(DEFAULTS, options);
// execute the plugin for each called element
return this.each(function(){
});
}
})( jQuery );
/**
* new static plugin template
*
* to call it $.pluginTitle();
*/
(function( $ ){
$.pluginTitle = function(options) {
// get the called element
var $container = $(this);
// default options
var DEFAULTS = {};
// extend user options with the default options
var options = $.extend(DEFAULTS, options);
// execute the plugin for each called element
return this.each(function(){
});
}
})( jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment