zoukankan      html  css  js  c++  java
  • 博客园主页特效之-鼠标点击特效

    这个鼠标点击的效果只需要通过下面这段代码即可实现:

    将如下代码放在页首、页脚或者公告栏部分都可以!

     1 <script type="text/javascript">
     2 /* 鼠标特效 */
     3 var a_idx = 0;
     4 jQuery(document).ready(function($) {
     5     $("body").click(function(e) {
     6         var a = new Array("❤Java❤","❤C++❤","❤PHP❤","❤Mysql❤","❤Oracle❤","❤.NET❤","❤JavaScript❤","❤H5❤","❤Python❤","❤Json❤","❤Ruby❤","❤Go❤");
     7         var $i = $("<span></span>").text(a[a_idx]);
     8         a_idx = (a_idx + 1) % a.length;
     9         var x = e.pageX,
    10         y = e.pageY;
    11         $i.css({
    12             "z-index": 999999999999999999999999999999999999999999999999999999999999999999999,
    13             "top": y - 20,
    14             "left": x,
    15             "position": "absolute",
    16             "font-weight": "bold",
    17             "color": "rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"
    18         });
    19         $("body").append($i);
    20         $i.animate({
    21             "top": y - 180,
    22             "opacity": 0
    23         },
    24         1500,
    25         function() {
    26             $i.remove();
    27         });
    28     });
    29 });
    30 </script>

    PS:css样式和点击的文字都可以在该代码中自行修改成自己想要的。

  • 相关阅读:
    HDU 4913 Least common multiple
    HDU 4915 Parenthese sequence
    HDU 2459 Maximum repetition substring
    HDU 5727 Necklace
    HDU 5724 Chess
    HDU 5726 GCD
    hihoCoder1033 交错和 数位DP
    2016百度之星资格赛题解
    10LaTeX学习系列之---Latex的文档结构
    09LaTeX学习系列之---Latex 字体的设置
  • 原文地址:https://www.cnblogs.com/lmyupupblogs/p/10268060.html
Copyright © 2011-2022 走看看