qTip是一个基于JQuery的Tooltip插件。它几乎支持所有的主流浏览器,例如:
Internet Explorer 6.0+
Firefox 2.0+
Opera 9.0+
Safari 3.0+
Google Chrome 1.0+
Konqueror 3.5+
使用qTip可以很轻松的定义tip的位置以及样式,同时qTip还有一个强大的API......
使用qTip前,只需引入两个JS文件即可:
1 |
Html代码 |
下面举几个比较简单的例子。
1、Basic text
html如下所示:
JS代码:
效果如图所示:

2、Title attribute
html如下所示:
JS代码:
01 |
|
02 |
<script type="text/javascript"> |
03 |
$(document).ready(function() |
04 |
{ |
05 |
$('#content a[href][title]').qtip({ |
06 |
content: { |
07 |
text: false |
08 |
}, |
09 |
style: 'cream' |
10 |
}); |
11 |
}); |
12 |
</script> |
效果如图所示:

3、Image
html如下所示:
JS代码:
效果如图所示:

4、Corner values
html如下所示:
JS代码:
01 |
|
02 |
<script type="text/javascript"> |
03 |
|
04 |
var corners = 'bottomLeft'; |
05 |
var opposites = 'topRight'; |
06 |
|
07 |
$(document).ready(function() |
08 |
{ |
09 |
$('#content a') |
10 |
.hover(function() |
11 |
{ |
12 |
$(this).html(opposites) |
13 |
.qtip({ |
14 |
content: corners, |
15 |
position: { |
16 |
corner: { |
17 |
tooltip: corners, |
18 |
target: opposites |
19 |
} |
20 |
}, |
21 |
show: { |
22 |
when: false, |
23 |
ready: true |
24 |
}, |
25 |
hide: false, |
26 |
style: { |
27 |
border: { |
28 |
5, |
29 |
radius: 10 |
30 |
}, |
31 |
padding: 10, |
32 |
textAlign: 'center', |
33 |
tip: true, |
34 |
name: 'cream' |
35 |
} |
36 |
}); |
37 |
}); |
38 |
}); |
39 |
</script> |
效果如图所示:

5、Fixed tooltips
html如下所示:
JS代码:
css代码:
01 |
|
02 |
<style type="text/css"> |
03 |
#content img{ |
04 |
float: left; |
05 |
margin-right: 35px; |
06 |
|
07 |
border: 2px solid #454545; |
08 |
padding: 1px; |
09 |
} |
10 |
</style> |
效果如图所示:

6、Loading html
html如下所示:
JS代码:
01 |
Js代码 |
02 |
<script type="text/javascript"> |
03 |
$(document).ready(function() |
04 |
{ |
05 |
$('#content a[rel]').each(function() |
06 |
{ |
07 |
$(this).qtip( |
08 |
{ |
09 |
content: { |
10 |
url: $(this).attr('rel'), |
11 |
title: { |
12 |
text: 'Wiki - ' + $(this).text(), |
13 |
button: 'Close' |
14 |
} |
15 |
}, |
16 |
position: { |
17 |
corner: { |
18 |
target: 'bottomMiddle', |
19 |
tooltip: 'topMiddle' |
20 |
}, |
21 |
adjust: { |
22 |
screen: true |
23 |
} |
24 |
}, |
25 |
show: { |
26 |
when: 'click', |
27 |
solo: true |
28 |
}, |
29 |
hide: 'unfocus', |
30 |
style: { |
31 |
tip: true, |
32 |
border: { |
33 |
0, |
34 |
radius: 4 |
35 |
}, |
36 |
name: 'light', |
37 |
570 |
38 |
} |
39 |
}) |
40 |
}); |
41 |
}); |
42 |
</script> |
效果如图所示:

7、Modal tooltips
html如下所示:
1 |
|
2 |
<div id="content"> |
3 |
<a href="#" rel="modal">Click here</a> |
4 |
</div> |
JS代码:
01 |
|
02 |
<script type="text/javascript"> |
03 |
$(document).ready(function() |
04 |
{ |
05 |
$('a[rel="modal"]:first').qtip( |
06 |
{ |
07 |
content: { |
08 |
title: { |
09 |
text: 'Modal tooltips sample', |
10 |
button: 'Close' |
11 |
}, |
12 |
text: 'hello world' |
13 |
}, |
14 |
position: { |
15 |
target: $(document.body), |
16 |
corner: 'center' |
17 |
}, |
18 |
show: { |
19 |
when: 'click', |
20 |
solo: true |
21 |
}, |
22 |
hide: false, |
23 |
style: { |
24 |
{ max: 350 }, |
25 |
padding: '14px', |
26 |
border: { |
27 |
9, |
28 |
radius: 9, |
29 |
color: '#666666' |
30 |
}, |
31 |
name: 'light' |
32 |
}, |
33 |
api: { |
34 |
beforeShow: function() |
35 |
{ |
36 |
$('#qtip-blanket').fadeIn(this.options.show.effect.length); |
37 |
}, |
38 |
beforeHide: function() |
39 |
{ |
40 |
$('#qtip-blanket').fadeOut(this.options.hide.effect.length); |
41 |
} |
42 |
} |
43 |
}); |
44 |
|
45 |
$('<div id="qtip-blanket">') |
46 |
.css({ |
47 |
position: 'absolute', |
48 |
top: $(document).scrollTop(), |
49 |
left: 0, |
50 |
height: $(document).height(), |
51 |
'100%', |
52 |
|
53 |
opacity: 0.7, |
54 |
backgroundColor: 'black', |
55 |
zIndex: 5000 |
56 |
}) |
57 |
.appendTo(document.body) |
58 |
.hide(); |
59 |
}); |
60 |
</script> |
效果如图所示:

修改用户家目录
mysql 我的学习
mysql 表空间
mysql cluster 运行的必备条件
浅谈mysql集群
RBAC权限管理
mysql 恢复备份
oracle10G/11G官方下载地址集合 直接迅雷下载
MySQL 全文搜索支持, mysql 5.6.4支持Innodb的全文检索和类memcache的nosql支持
- 最新文章
-
hibernate 单向 n-n
linux下c程序 daemon、fork与创建pthread的顺序问题
将 java 改写成 beanshell 的经验之谈
使用Django和Python创建Json response
设计模式C++实现——适配器模式
CodeChef Ada Pawns
2019-8-31-How-to-output-the-target-message-in-dotnet-build-command-line
2019-8-31-How-to-output-the-target-message-in-dotnet-build-command-line
2019-3-15-uwp-ScrollViewer-content-out-of-panel-when-set-the-long-width
2019-3-15-uwp-ScrollViewer-content-out-of-panel-when-set-the-long-width
- 热门文章
-
2019-10-7-WPF-will-break-when-an-exception-be-throw-in-the-StylusPlugIn
2019-10-7-WPF-will-break-when-an-exception-be-throw-in-the-StylusPlugIn
2019-4-29-Roslyn-将这个文件放在你的项目文件夹,无论哪个控制台项目都会输出林德熙是逗比...
2019-4-29-Roslyn-将这个文件放在你的项目文件夹,无论哪个控制台项目都会输出林德熙是逗比...
2019-8-31-dotnet-线程静态字段
2019-8-31-dotnet-线程静态字段
PHP mysqli_thread_id() 函数
PHP mysqli_stmt_init() 函数
PHP mysqli_stat() 函数
PHP mysqli_ssl_set() 函数