闲着没事写了个鼠标提示效果


闲着没事写了个鼠标提示的插件,可以模拟title的效果,样式可以自定义  使用时只需选中需要应用该插件的元素即可 $(" .tit a ").jtit();

 $.fn.jtit=function(){

var _this=$(this);

var tit=_this.attr("title");

if(!tit) return;

var tip=$("#tip");

$(this)

.mouseover(function(e){

tit=$(e.target).attr("title") || $(e.target).parent("a").attr("title") ;

tip.find("p").text(tit);

})

.mousemove(function(e){

var x=e.pageX-8;

var y=e.pageY+36;

tip.css({ "left":x,"top":y }).show();

return false;

})

.mouseout(function(){

tip.hide();

})

}

原文地址:https://www.cnblogs.com/trance/p/1624867.html