-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
155 lines (141 loc) · 4.49 KB
/
index.html
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Trying tooltips</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="css/project.css" rel="stylesheet"/>
<style>
.meter {
height: 20px; /* Can be anything */
position: relative;
margin: 60px 0 20px 0; /* Just for demo spacing */
background: #555;
-moz-border-radius: 25px;
-webkit-border-radius: 25px;
border-radius: 25px;
padding: 10px;
-webkit-box-shadow: inset 0 -1px 1px rgba(255,255,255,0.3);
-moz-box-shadow : inset 0 -1px 1px rgba(255,255,255,0.3);
box-shadow : inset 0 -1px 1px rgba(255,255,255,0.3);
}
.meter > span {
display: block;
height: 100%;
-webkit-border-top-right-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
-moz-border-radius-topright: 8px;
-moz-border-radius-bottomright: 8px;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-top-left-radius: 20px;
-webkit-border-bottom-left-radius: 20px;
-moz-border-radius-topleft: 20px;
-moz-border-radius-bottomleft: 20px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: rgb(43,194,83);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0, rgb(43,194,83)),
color-stop(1, rgb(84,240,84))
);
background-image: -moz-linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
-webkit-box-shadow:
inset 0 2px 9px rgba(255,255,255,0.3),
inset 0 -2px 6px rgba(0,0,0,0.4);
-moz-box-shadow:
inset 0 2px 9px rgba(255,255,255,0.3),
inset 0 -2px 6px rgba(0,0,0,0.4);
box-shadow:
inset 0 2px 9px rgba(255,255,255,0.3),
inset 0 -2px 6px rgba(0,0,0,0.4);
position: relative;
overflow: hidden;
}
.meter > span:after {
content: "";
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
background-image:
-webkit-gradient(linear, 0 0, 100% 100%,
color-stop(.25, rgba(255, 255, 255, .2)),
color-stop(.25, transparent), color-stop(.5, transparent),
color-stop(.5, rgba(255, 255, 255, .2)),
color-stop(.75, rgba(255, 255, 255, .2)),
color-stop(.75, transparent), to(transparent)
);
z-index: 1;
-webkit-background-size: 50px 50px;
background-size: 50px 50px;
-webkit-animation: move 2s linear infinite;
-webkit-border-top-right-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-top-left-radius: 20px;
-webkit-border-bottom-left-radius: 20px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
overflow: hidden;
}
</style>
</head>
<body>
<div class="meter">
<span style="width: 25%"></span>
</div>
<a href="#" title="Tooltip standard">tooltip 0</a>
<a id="tooltip_0" class="tooltip" href="#" title="Tooltip jQuery">tooltip 1</a>
<script src="js/jquery-1.9.0.js"></script>
<script>
function tooltip_create_div(name) {
div = "<div class='tooltip' id='tooltip_" + name + "'>" ;
div += " <p>";
div += $(this).attr('title');
div += " </p>";
div += "</div>";
return div;
}
/****
* target: jQuery object
* name: name of tooltip
*
*/
function simple_tooltip(targets, name) {
targets.each( function(i, anchor ) {
var div = tooltip_create_div.call( anchor, name + '_' + i.toString() );
$("body").append( div );
var my_tool = $("#tooltip_" + name + "_" + i);
$(this).removeAttr("title");
$(this).mouseover(function(){
my_tool.css({opacity:0.8, display:"none"}).fadeIn(400);
});
$(this).mousemove(function(kmouse){
var obj = $( "#" + kmouse.currentTarget.id );
var offset = obj.offset();
var x = offset.left + obj.width();
var y = offset.top + obj.height();
my_tool.css({left:x, top:y});
});
$(this).mouseout(function(){
my_tool.fadeOut(400);
});
});
};
$(document).ready( function() {
allToolTips = $('.tooltip');
simple_tooltip( allToolTips, 'test' );
});
</script>
</body>
</html>