sword

给Typecho、Emlog等博客网站添加鼠标点击文字特效
说明:鼠标点击文字特效很多博客都有,相信也有很多人需要,这里就分享个方法,适合大部分博客,包括Typecho,Em...
扫描右侧二维码阅读全文
18
2018/08

给Typecho、Emlog等博客网站添加鼠标点击文字特效

说明:鼠标点击文字特效很多博客都有,相信也有很多人需要,这里就分享个方法,适合大部分博客,包括Typecho,Emlog等。有兴趣的可以试试。

截图
请输入图片描述

方法
将代码放在主题的footer.php中的</body>之前即可

<script type="text/javascript"> 
/* 鼠标特效 */
var a_idx = 0; 
jQuery(document).ready(function($) { 
    $("body").click(function(e) { 
        var a = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正" ,"法治", "爱国", "敬业", "诚信", "友善"); 
        var $i = $("<span/>").text(a[a_idx]); 
        a_idx = (a_idx + 1) % a.length; 
        var x = e.pageX, 
        y = e.pageY; 
        $i.css({ 
            "z-index": 999999999999999999999999999999999999999999999999999999999999999999999, 
            "top": y - 20, 
            "left": x, 
            "position": "absolute", 
            "font-weight": "bold", 
            "color": "#ff6651" 
        }); 
        $("body").append($i); 
        $i.animate({ 
            "top": y - 180, 
            "opacity": 0 
        }, 
        1500, 
        function() { 
            $i.remove(); 
        }); 
    }); 
}); 
</script>

特效字体可以自行设置

原文链接:https://www.moerats.com/archives/373/

Last modification:August 27th, 2018 at 10:00 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment

5 comments

  1. 无双   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 78.0.3904.108 Google Chrome 78.0.3904.108 )

    这个爱心是咋打出来嗒?

    1. sword   ( Windows Server 2003 Windows Server 2003 / Google Chrome 55.0.2883.96 Google Chrome 55.0.2883.96 )
      @无双

      类似这个,具体的我也忘了
      https://sword.studio/86.html

      1. 无双   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 78.0.3904.108 Google Chrome 78.0.3904.108 )
        @sword

        那这里面有哪行代码是改大小的吗OωO

      2. 无双   ( Windows 10 x64 Edition Windows 10 x64 Edition / Microsoft Edge 18.18362 Microsoft Edge 18.18362 )
        @sword

        好吧

  2. 任鸟飞   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 68.0.3440.106 Google Chrome 68.0.3440.106 )

    搞这么花里胡哨的特效,很多初学者都搞这玩意。