Last active
August 29, 2015 14:15
-
-
Save prbaron/e8382c85ec520c43f09e to your computer and use it in GitHub Desktop.
jQuery plugin 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
/** | |
* 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