jquery提示效果实例分析

时间:2014-11-25    点击:74   

本文实例讲述了jquery提示效果的用法。分享给大家供大家参考。具体实现方法如下:

复制代码 代码如下:
<p><a href="#" class="tooltip" title="这是我的超链接提示1.">提示1.</a></p>
<p><a href="#" class="tooltip" title="这是我的超链接提示2.">提示2.</a></p>
<p><a href="#" title="这是自带提示1.">自带提示1.</a></p>
<p><a href="#" title="这是自带提示2.">自带提示2.</a></p>

$(function(){
    $(".tooltip").mouseenter(function(e){
 this.mytitle=this.title
 this.title=""
 var a="<div>"+this.mytitle+"</div>"
 $("body").append(a);
 $("div").css({
     "top": (e.pageY + y) + "px",
     "left": (e.pageX  + x) + "px"
 }).show("fast")
    }).mouseout(function(){
 this.title= this.mytitle;
 $("div").remove();
     });
})

心得体会:

不要在p标签下追加div元素,会出现一个大的偏差值!

原来!this和$("this")是有所不同,如果上文this.title改写成$("this").attr("title")会导致下面的mouseout事件无法访问保存下来的title。

希望本文所述对大家的jQuery程序设计有所帮助。

浅析node.js中close事件
nodejs中转换URL字符串与查询字符串详解
JS简单操作select和dropdownlist实例
node.js使用require()函数加载模块
javascript中setTimeout和setInterval的unref()和ref()用法示例
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved