-
Notifications
You must be signed in to change notification settings - Fork 0
/
simpleTags.jQuery.js
44 lines (40 loc) · 933 Bytes
/
simpleTags.jQuery.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
(function($){
$.fn.simpleTags = function(options){
var element = this;
var defaults = {
sizes: [100, 120, 140, 90, 180],
colorNormal: "gray",
colorHover: "red",
tagsWidth: "300px",
fonts: "courier"
}
var options = $.extend(defaults, options);
$(element).css({
width: options.tagsWidth,
fontFamily: options.fonts
});
$(element).children("li").each(function(){
var size = options.sizes[Math.floor(Math.random() * options.sizes.length)];
$(this).css({
fontSize: size + '%',
margin: '0',
padding: '0',
listStyle: 'none',
display: 'inline'
});
$(this).children("a").css({
textDecoration: 'none',
padding: '0 2px',
color: options.colorNormal
});
$(this).children("a").hover(
function(){
$(this).css('color', options.colorHover)
},
function(){
$(this).css('color', options.colorNormal)
}
);
});
};
}) (jQuery);