forked from Ins-V/iTooltip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
193 lines (170 loc) · 6.75 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>iTooltip</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/atom-one-light.min.css">
<style>
html, body {
margin: 0;
padding: 0;
}
body {
font-size: 16px;
}
h1, h2, h3 { margin: 0; }
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #d0d0d0;
}
section {
width: 100%;
margin: 30px auto;
padding: 0 30px;
box-sizing: border-box;
}
section header {
margin: 15px 0;
padding-left: 10px;
border-left: 15px solid #d0d0d0;
border-bottom: 1px solid #d0d0d0;
}
ul { font-size: 18px; }
footer {
font-size: 18px;
border-top: 1px solid #d0d0d0;
background-color: #fafafa;
}
.font-weight-bold {
font-weight: bold;
font-size: 18px;
}
#header-page {
height: 100px;
line-height: 100px;
background-color: #209cee;
color: #fff;
text-align: center;
}
.text-right { text-align: right; }
.text-center { text-align: center; }
/* Test style */
.tooltip {
border: 1px solid #696969;
background-color: #d0d0d0;
padding: 3px;
z-index: 9999;
}
</style>
</head>
<body>
<header id="header-page">
<h1>iTooltip</h1>
</header>
<section>
<header>
<h3>Examples:</h3>
</header>
<div class="font-weight-bold">
<span title="Simple tooltip.">Simple tooltip.</span>
</div>
<div class="text-right font-weight-bold">
<span title="Dynamic turn to the left.">Dynamic turn to the left.</span>
</div>
<div class="font-weight-bold">
<span title="<i>HTML</i> in the <b>tooltip</b>.">HTML in the tooltip.</span>
</div>
<div class="text-center font-weight-bold">
<span title="Image in the tooltip.<br><hr><img src='https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png'>">Image in the tooltip.</span>
</div>
</section>
<section>
<header>
<h3>Use on page:</h3>
</header>
<div>
<pre><code class="html"><span title="Simple tooltip.">Simple tooltip.</span>
<span title="<i>HTML</i> in the <b>tooltip</b>.">HTML in the tooltip.</span>
<script src="/path/to/iTooltip.js"></script>
<script>
// Apply to all elements with an attribute title.
var tooltip = new iTooltip() // Or var tooltip = new iTooltip('*')
tooltip.init()
</script></code></pre>
</div>
<hr>
<div>
<pre><code class="js">// Change selector.
var tooltip = new iTooltip('.my-selector')
tooltip.init()</code></pre>
</div>
<hr>
<div>
<pre><code class="js">// Set options.
var tooltip = new iTooltip()
tooltip.init({
className: 'my-class-name', // Changes the class name for a block with a hint.
indentX: 3, // Horizontal indent. (In pixels)
indentY: 3, // Vertical indent. (In pixels)
// The initial position of the tooltip horizontally.
positionX: 'left', // Variants: 'left', 'right', 'center'.
// The initial position of the tooltip vertically.
positionY: 'center' // Variants: 'top', 'bottom', 'center'.
// WARNING!
// positionX and positionY can not simultaneously have the value "center".
})</code></pre>
</div>
</section>
<section>
<header>
<h3>Default options:</h3>
</header>
<div>
<ul>
<li><b>className</b> - tooltip</li>
<li><b>indentX</b> - 10px</li>
<li><b>indentY</b> - 15px</li>
<li><b>positionX</b> - right</li>
<li><b>positionY</b> - bottom</li>
</ul>
</div>
</section>
<section>
<header>
<h3>Change the style for the tooltip:</h3>
</header>
<div>
<pre><code class="css">.tooltip { /* or your class if changed */
background-color: #282c34;
color: #98c379;
/* other styles */
}</code></pre>
</div>
</section>
<footer class="text-center">
<p>
<a href="https://github.com/Ins-V/iTooltip" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="40px" height="40px" viewBox="0 0 438.549 438.549" style="enable-background:new 0 0 438.549 438.549;" xml:space="preserve">
<g transform="matrix(0.696413 0 0 0.696413 66.5688 66.5688)">
<g>
<path d="M409.132,114.573c-19.608-33.596-46.205-60.194-79.798-79.8C295.736,15.166,259.057,5.365,219.271,5.365 c-39.781,0-76.472,9.804-110.063,29.408c-33.596,19.605-60.192,46.204-79.8,79.8C9.803,148.168,0,184.854,0,224.63 c0,47.78,13.94,90.745,41.827,128.906c27.884,38.164,63.906,64.572,108.063,79.227c5.14,0.954,8.945,0.283,11.419-1.996 c2.475-2.282,3.711-5.14,3.711-8.562c0-0.571-0.049-5.708-0.144-15.417c-0.098-9.709-0.144-18.179-0.144-25.406l-6.567,1.136 c-4.187,0.767-9.469,1.092-15.846,1c-6.374-0.089-12.991-0.757-19.842-1.999c-6.854-1.231-13.229-4.086-19.13-8.559 c-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559 c-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-0.951-2.568-2.098-3.711-3.429c-1.142-1.331-1.997-2.663-2.568-3.997 c-0.572-1.335-0.098-2.43,1.427-3.289c1.525-0.859,4.281-1.276,8.28-1.276l5.708,0.853c3.807,0.763,8.516,3.042,14.133,6.851 c5.614,3.806,10.229,8.754,13.846,14.842c4.38,7.806,9.657,13.754,15.846,17.847c6.184,4.093,12.419,6.136,18.699,6.136 c6.28,0,11.704-0.476,16.274-1.423c4.565-0.952,8.848-2.383,12.847-4.285c1.713-12.758,6.377-22.559,13.988-29.41 c-10.848-1.14-20.601-2.857-29.264-5.14c-8.658-2.286-17.605-5.996-26.835-11.14c-9.235-5.137-16.896-11.516-22.985-19.126 c-6.09-7.614-11.088-17.61-14.987-29.979c-3.901-12.374-5.852-26.648-5.852-42.826c0-23.035,7.52-42.637,22.557-58.817 c-7.044-17.318-6.379-36.732,1.997-58.24c5.52-1.715,13.706-0.428,24.554,3.853c10.85,4.283,18.794,7.952,23.84,10.994 c5.046,3.041,9.089,5.618,12.135,7.708c17.705-4.947,35.976-7.421,54.818-7.421s37.117,2.474,54.823,7.421l10.849-6.849 c7.419-4.57,16.18-8.758,26.262-12.565c10.088-3.805,17.802-4.853,23.134-3.138c8.562,21.509,9.325,40.922,2.279,58.24 c15.036,16.18,22.559,35.787,22.559,58.817c0,16.178-1.958,30.497-5.853,42.966c-3.9,12.471-8.941,22.457-15.125,29.979 c-6.191,7.521-13.901,13.85-23.131,18.986c-9.232,5.14-18.182,8.85-26.84,11.136c-8.662,2.286-18.415,4.004-29.263,5.146 c9.894,8.562,14.842,22.077,14.842,40.539v60.237c0,3.422,1.19,6.279,3.572,8.562c2.379,2.279,6.136,2.95,11.276,1.995 c44.163-14.653,80.185-41.062,108.068-79.226c27.88-38.161,41.825-81.126,41.825-128.906 C438.536,184.851,428.728,148.168,409.132,114.573z" data-original="#000000" class="active-path" fill="#000000"/>
</g>
</g>
</svg>
</a>
</p>
<p>License: <b>MIT</b></p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="/js/iTooltip.js"></script>
<script>
window.onload = function () {
let tooltip = new iTooltip()
tooltip.init()
}
</script>
</body>
</html>