-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjqueryPlugin.html
More file actions
38 lines (33 loc) · 887 Bytes
/
jqueryPlugin.html
File metadata and controls
38 lines (33 loc) · 887 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
32
33
34
35
36
37
38
<!DOCTYPE HTML>
<html>
<head>
<title>jQuery plugin test</title>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<div class="test">
<p>basic jQuery plugin. </p>
<pre>
$.fn.functionName = function(options){
// do something about this and return this.
}
</pre>
</div>
<script>
(function ($) {
$.fn.applyStyles = function (options) {
var opts = $.extend({}, $.fn.applyStyles.defaults, options);
this.css(opts);
return this;
};
})(jQuery);
$.fn.applyStyles.defaults = {
"color": "red",
"background-color": "yellow",
"border": "2px solid red"
};
$.fn.applyStyles.defaults.color = "blue";
$("div.test").applyStyles({"background-color": "gray", "border":"6px groove green", "padding": "1em"});
</script>
</body>
</html>