jQuery Tooltip插件

Cut & Paste Ajax Tooltip script v1.2

Credit: JavaScript Kit

Last update (v1.2 July 10th, 08'): Modified tooltip to follow mouse, added Ajax "loading" message.

Description: This Ajax script enhances the default "title " attribute of HTML so certain tooltips can instead get their contents from an external file, with rich HTML content and all. Integration is easy and non obtrusive, and for the sake of efficiency, the script will only use Ajax to load the tooltip's content the very first time the user rolls over the attached element.

Example:

Try moving your mouse over this link to see an Ajax tooltip shown, with its contents dynamically populated from an external file. Or, try it with the below DIV instead:

I am a DIV with an ajax tooltip added! Roll your mouse over here.

Directions:

Step 1: Insert the below into the <head> section of your page:

<script type="text/javascript" src="jquery-1.2.2.pack.js"></script> <style type="text/css"> .ajaxtooltip{ position: absolute; /*leave this alone*/ display: none; /*leave this alone*/ width: 300px; left: 0; /*leave this alone*/ top: 0; /*leave this alone*/ background: lightyellow; border: 2px solid gray; border-width: 1px 2px 2px 1px; padding: 5px; } </style> <script type="text/javascript" src="ajaxtooltip.js"> /*********************************************** * Ajax Tooltip script- by JavaScript Kit (www.javascriptkit.com) * This notice must stay intact for usage * Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more ***********************************************/ </script>

The code above references two external .js files, plus one image. Download them below:

Step 2: Then to add an ajax tooltip to any element on your page, just use the "title" attribute of HTML as usual, but with the following convention:

<a href="#" title="ajax: external.htm">Some link</a>

where "external.htm " is to relative path to the external page on your server to populate the tooltip using, always proceeded with the keyword "ajax: " to tell the script that this is an ajax tooltip. For testing purposes, here is the "external.htm " file (right click, and choose "Save As") you can quickly use to test out the script.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值