飞飞CMS官方论坛
标题:
给网站加一个单击显示提示动画功能
[打印本页]
作者:
w3sf6r6dx4Mn
时间:
2024-8-5 14:22
标题:
给网站加一个单击显示提示动画功能
复制代码放到tpl/模板/html/public/foot.html文件最底下
重新打开网站单击后就可以看到效果了
<script>
var a_idx = 0;
$("body").click(function(e) {
var a = ["主人回家啦!","还想要嘛~", "好舒服啊~", "帮主人揉揉~", "啊~啊~", "主人辛苦了!", "主人,我想要~" ,"好开心~", "太大了啊~", "疼~~", "好喜欢主人", "萌萌在洗澡~"];
var $i = $("<span/>").text(a[a_idx]);
a_idx = Math.floor((Math.random()*a.length));
var x = e.pageX,
y = e.pageY;
$i.css({
"z-index": 99999999,
"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>
欢迎光临 飞飞CMS官方论坛 (http://feifeicms.me/)
Powered by Discuz! X3.2