forked from jquery-boilerplate/jquery-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery.boilerplate.min.js
More file actions
31 lines (28 loc) · 834 Bytes
/
jquery.boilerplate.min.js
File metadata and controls
31 lines (28 loc) · 834 Bytes
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
;(function ($, window, document, undefined) {
var pluginName = "defaultPluginName";
var defaults = {
propertyName: "value"
};
function Plugin(element, options) {
this.element = element;
this.options = $.extend({}, defaults, options);
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Plugin.prototype = {
init: function () {
// code goes here
},
yourOtherFunction: function () {
// some logic
}
};
$.fn[pluginName] = function (options) {
return this.each(function () {
if (!$.data(this, "plugin_" + pluginName)) {
$.data(this, "plugin_" + pluginName, new Plugin(this, options));
}
});
};
})(jQuery, window, document);