导航

网页鼠标单击特效

• June 30, 2017 • Read: 679 • 每日必看

网页鼠标单击特效
body 标签 前面插入以下代码即可实现 鼠标单击随机 字符,内容可自定义。

<script>
  $("html,body").click(function(e) {
    var gcd = new Array("❤", "^_^", "自由", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善");
    var n = Math.floor(Math.random() * gcd.length);
    var $i = $("<b/>").text(gcd[n]);
    var x = e.pageX,
    y = e.pageY;
    $i.css({
      "z-index": 99999,
      "top": y - 20,
      "left": x,
      "position": "absolute",
      "color": "#1ecd97"
    });
    $("body").append($i);
    $i.animate({
      "top": y - 180,
      "opacity": 0
    },
    1500,
    function() {
      $i.remove()
    });
    e.stopPropagation()
  });
</script>

Tags: 日常
查看所有文章 QR Code Tip
QR Code for this page
Tipping QR Code
0:00