Hola:
Es algo muy simple: en los <script>, no existe el atributo
href, sino
src, así que cambia eso y funcionará :P.
Yo modifiqué el código del plugin para que puedas usarlo de distintas formas:
<body>
<style>
.red { color: red; }
</style>
<a href="#" title="Lo que aparecerá en el <span class='red'>tooltip</span> del enlace 1" id="enlace1">Enlace uno</a>
<a href="#" id="enlace2">Enlace dos</a>
<a href="#" id="enlace3">Enlace tres</a>
<div class="hovertipContent">
Contenido del tooltip para el enlace 3
</div>
<script>
jQuery(document).ready(function($) {
$('#enlace1').hovertip();
$('#enlace2').hovertip({
tooltipText: 'Texto del <span style="color: blue;">tooltip</span> para el enlace 2'
});
$('#enlace3').hovertip();
});
</script>
</body>
Código del script:
/*
* @Author: Adam M Rivera
* @Description: Simple clean hovertip extension.
*
* Copyright (c) 2009 Adam M Rivera
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
(function($){var methods={init:function(options){if($("#hovertip").length<1)$('body').append('<div id="hovertip"></div>');var hovertip=$('#hovertip'),leftDelta=0,topDelta=0,windowWidth=0,windowHeight=0,scrollTop=0;return this.each(function(){var obj=$(this);var text='';var title=false;obj.hover(function(e){if(options!==undefined&&options.tooltipText!==undefined&&options.tooltipText.length>0){text=options.tooltipText}else if(obj.attr('title')!==undefined&&obj.attr('title').length>0){text=obj.attr('title');obj.removeAttr('title');title=true}else{text=$(this).next().html()}hovertip.html(text);windowWidth=$(window).width();windowHeight=$(window).height();scrollTop=$(window).scrollTop();if(windowWidth-e.pageX<hovertip.width()*2+30)leftDelta=hovertip.width()+30;if(((windowHeight+scrollTop)-e.pageY)<hovertip.height()*2+30)topDelta=hovertip.height()+30;hovertip.css({'top':((e.pageY+15)-topDelta)+'px','left':((e.pageX+15)-leftDelta)+'px','display':'block'});$().mousemove(function(e){hovertip.css({'top':((e.pageY+15)-topDelta)+'px','left':((e.pageX+15)-leftDelta)+'px'})})},function(){$().unbind('mousemove');hovertip.empty().css('display','none');leftDelta=0;topDelta=0;if(title)obj.attr('title',text)})})}};$.fn.hovertip=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof method=='object'||!method){return methods.init.apply(this,arguments)}else{$.error('The method '+method+' does not exists.')}return this}})(jQuery);