- 时间:2020-12-28 20:08 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:Mootools 1.2教程 Tooltips
我们还将仔细学习一下工具提示的选项和事件,还有一些用来从元素上添加和移除工具提示的工具。最后,我们将学习一下怎么让一个页面有多个不同样式的工具提示。
基础知识
创建一个新的工具提示
创建一个新的工具提示非常简单。首先,我们来创建一个要添加工具提示的链接:
参考代码:
[url=http://www.consideropen.com]
MooTools 1.2工具提示将默认显示链接中的title和rel属性的值。如果没有rel属性,将显示href属性值。
现在来创建一个新的默认工具条提示:
参考代码:
var customTips = $$('.tooltipA');
var toolTips = new Tips(customTips);
由于没有使用任何样式,你将看到下面这样的工具提示:
Tool tip 1
为你的工具提示使用样式
MooTools可以让你在很大程度上控制它的输出——我们来看一下工具提示的html代码:
参考代码:
[url=http://www.consideropen.com/]Tool tip 1[/url]
[url=http://www.consideropen.com/blog]Tool tip is detached[/url]
[url=http://www.consideropen.com/contact]Tool tip 3[/url]
[url=http://www.consideropen.com/blog/2008/08/30-days-of-mootools-12-tutorials-day-1-intro-to-the-library/]Tool tip detached then attached again. [/url]
[url=http://www.consideropen.com/]A differently styled tool tip[/url]
[h2]更多学习[/h2]
通读一遍MooTools文档中的[url=http://docs.mootools.net/Plugins/Tips]Tips这一节[/url]。另外,这里还有David Walsh写的一篇很不错的关于[url=http://davidwalsh.name/mootools-12-tooltips-customize]定制Mootools Tips[/url]的文章。
[b][url=http://www.consideropen.com/downloads/30days_of_moo/mootorial_day19_tooltips.zip]下载一个包含你所需要的全部东西的zip压缩包[/url][/b]