您的位置:首页 > Web前端 > JQuery

jQuery 入门教程(43): jQuery UI Tooltip 示例

2014-01-16 19:11 549 查看


JQuerytooltip的基本用法,可以把所有元素的的title属性做为Toolbar显示,比如:

1
<!doctypehtml>
2
<
html
lang
=
"en"
>
3
<
head
>
4
<
meta
charset
=
"utf-8"
/>
5
<
title
>jQueryUIDemos</
title
>
6
<
link
rel
=
"stylesheet"
href
=
"themes/trontastic/jquery-ui.css"
/>
7
<
script
src
=
"scripts/jquery-1.9.1.js"
></
script
>
8
<
script
src
=
"scripts/jquery-ui-1.10.1.custom.js"
></
script
>
9
<
script
>
10
$(function(){
11
$(document).tooltip();
12
});
13
</
script
>
14
<
style
>
15
label{
16
display:inline-block;
17
width:5em;
18
}
19
</
style
>
20
</
head
>
21
<
body
>
22
23
<
p
><
a
href
=
"#"
title
=
"That's
whatthiswidgetis"
>Tooltips</
a
>canbeattachedtoanyelement.Whenyouhover
24
theelementwithyourmouse,thetitleattributeisdisplayedinalittleboxnexttotheelement,justlikeanativetooltip.</
p
>
25
<
p
>Butasit'snotanativetooltip,itcanbestyled.Anythemesbuiltwith
26
<
a
href
=
"http://themeroller.com"
title
=
"ThemeRoller:
jQueryUI'sthemebuilderapplication"
>ThemeRoller</
a
>
27
willalsostyletooltipsaccordingly.</
p
>
28
<
p
>Tooltipsarealsousefulforformelements,toshowsomeadditionalinformationinthecontextofeachfield.</
p
>
29
<
p
><
label
for
=
"age"
>Your
age:</
label
><
input
id
=
"age"
title
=
"We
askforyourageonlyforstatisticalpurposes."
/></
p
>
30
<
p
>Hoverthefieldtoseethetooltip.</
p
>
31
32
33
</
body
>
34
</
html
>




此外,可以通过CSS修改缺省Tooltip的显示风格,或是自定义Tooltip显示内容(比如地图,图像等等),这里就不一一介绍了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: