jquery悬浮提示框

  1. <html>  
  2. <head>  
  3. <script type="text/javascript" src="jquery.js"></script>  
  4.     <script type="text/javascript">  
  5.         $(function() {  
  6.             x = 5;  
  7.             y = 15;  
  8.             $("p").hover(function(e) {  
  9.                 otitle = this.title;  
  10.                 this.title = "";  
  11.                 var ndiv = "<div id='leo'>" + otitle + "</div>";  
  12.                 $("body").append(ndiv);  
  13.                 $("#leo").css({  
  14.                     "top" : (e.pageY + y) + "px",  
  15.                     "left" : (e.pageX + x) + "px"  
  16.                 }).show(2000);  
  17.                 $(this).mousemove(function(e) {  
  18.                     $("#leo").css({  
  19.                         "top" : (e.pageY + y) + "px",  
  20.                         "left" : (e.pageX + x) + "px"  
  21.                     }).show(1000);  
  22.                 });  
  23.             }, function() {  
  24.                 this.title = otitle;  
  25.                 $("#leo").remove();  
  26.             });  
  27.         });  
  28.     </script>  
  29.     <style type="text/css">  
  30.         #leo {  
  31.             position: absolute;  
  32.             border: 1px solid grey;  
  33.             opacity: 0.8;  
  34.             background: grey;  
  35.         }  
  36.     </style>  
  37. </head>  
  38. <body>  
  39.     <p title="1dfgfdgdfg">If you click on me, I will disappear.</p>  
  40.     <p title="2dgfdgdfgdf">If you click on me, I will disappear.</p>  
  41.     <p title="3dgfdgfdgfder">If you click on me, I will disappear.</p>  
  42.     <p title="4ghfghfghfhgf">If you click on me, I will disappear.</p>  
  43. </body>  
  44. </html>


转自:blog.csdn.net/xpsharp/article/details/8307881

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值