工具提示条是许多应用程序中常见的特性,WEB浏览器也不例外。而我们可以通过自定义的文本来模拟工具提示条,这样就能在适当的地方提醒用户应该怎么操作,起到适当引导操作的效果,也算是小小的人性化设计。对于toolTip这种小功能如果用Javascript来实现也要相当的代码量,而用JQuery则比较清晰明了,让我们专注于功能代码的编写。
以下为最基础的toolTip模型:
以下是JQuery代码:
html代码非常简单,只要给a标签一个class做为程序调用的钩子就可以了
1 <div class="test">
2 <p><a href="#" class="show" title="We don't have anymore money!">show me the money</a></p>
3 <p><a href="#" class="show" title="follow me! go!go!go!">follow me
</a></p>
4 </div>
5
2 <p><a href="#" class="show" title="We don't have anymore money!">show me the money</a></p>
3 <p><a href="#" class="show" title="follow me! go!go!go!">follow me
4 </div>
5