lib-jquery-plugin-tooltip-ajaxtooltip.js / js
//Ajax Tooltip script: By JavaScript Kit: http://www.javascriptkit.com //Last update (July 10th, 08'): Modified tooltip to follow mouse, added Ajax "loading" message. var ajaxtooltip={ fadeeffect: [true, 300], //enable Fade? [true/false, duration_milliseconds] useroffset: [10, 10], //additional x and y offset of tooltip from mouse cursor, respectively loadingHTML: '<div style="font-style:italic"><img src="ajaxload.gif" /> Fetching Tooltip...</div>', positiontip:function(tooltip.get(0).offsetWidth var theight=//account for right edge tipy=(e.clientY+theight>docheight)? tipy-theight-(2*this.useroffset[0]) : tipy //account for bottom edge tooltip.css({left: tipx, top: tipy}) }, showtip:function(tooltip.hide().fadeIn(this.fadeeffect[1]) else tooltip, e){ if (this.fadeeffect[0]) tooltip.hide() } } jQuery(document).ready(function(){ ajaxtooltip.iebody=(document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body var tooltips=[] //array to contain references to all tooltip DIVs on the page $('*[@title^="ajax:"]').each(function(index){ //find all links with "title=ajax:" declaration this.titleurl=jQuery.trim(this.getAttribute('title').split(':')[1]) //get URL of external file this.titleposition=index+' pos' //remember this tooltip DIV's position relative to its peers tooltips.push($('<div class="ajaxtooltip"></div>').appendTo('body')) var target.removeAttr('title') //onMouseover element var tooltip=tooltips[parseInt(this.titleposition)] if (!//first time fetching Ajax content for this tooltip? tooltip.html(ajaxtooltip.loadingHTML).show() tooltip, e) ajaxtooltip.showtip(tooltip.get(0).loadsuccess=true }) } else{ ajaxtooltip.positiontip(tooltip, e) } }, function(e){ //onMouseout element var tooltip, e) } ) tooltip=tooltips[parseInt(this.titleposition)] ajaxtooltip.positiontip(
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.