forked from hantu/jquery-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery-plugin-template.js
46 lines (39 loc) · 962 Bytes
/
jquery-plugin-template.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* A jQuery plugin template
* Basically used as personal reference
*
* Author: Andy Goh (hantu)
* Website: http://www.andygoh.net
*
* Revisions:
* 0.1 - Initial commit
*
* References:
* http://www.learningjquery.com/2007/10/a-plugin-development-pattern
* http://docs.jquery.com/Plugins/Authoring
*
* Notes:
* - Good idea to name your file jquery.pluginName.js
*/
(function($) {
// replace 'pluginName' with the name of your plugin
$.fn.pluginName = function(options) {
// plugin default options
var defaults = {
};
// extends defaults with options provided
if (options) {
$.extend(defaults, options);
}
// iterate over matched elements
return this.each(function() {
// implementations
});
};
// public functions definition
$.fn.pluginName.functionName = function(foo) {
return this;
};
// private functions definition
function foobar() {}
})(jQuery);