鼠标点击效果代码

鼠标点击效果代码

实现代码

插到博客侧边栏公告

 1 <script type="text/javascript">
 2         var a_idx = 0;
 3         jQuery(document).ready(function($) {
 4         $("body").click(function(e) {
 5         var a = new Array("❤喜欢就关注一下吧❤","❤不是点这里哦❤","❤快去点赞❤","❤在文章最下面哦❤","❤快去推荐一下吧❤","❤感谢观看❤","❤");
 6         var $i = $("<span></span>").text(a[a_idx]);
 7         a_idx = (a_idx + 1) % a.length;
 8         var x = e.pageX,
 9         y = e.pageY;
10         $i.css({
11             "z-index": 999999999999999999999999999999999999999999999999999999999999999999999,
12             "top": y - 20,
13             "left": x,
14             "position": "absolute",
15             "font-weight": "bold",
16             "color": "rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"
17         });
18         $("body").append($i);
19         $i.animate({
20             "top": y - 180,
21             "opacity": 0
22         },
23         1500,
24         function() {
25             $i.remove();
26         });
27     });
28 });
29 </script>
原文地址:https://www.cnblogs.com/lanyincao/p/11768315.html