鼠标特效

原创 韩秀利 随笔 javascript 190阅读 26 天前 举报

<script>
/ 鼠标特效 /
var n = 0;
$("body").click(function(e) {
var arr = ["❤记得好评哦❤","❤记得打赏哦❤","❤记得关注哦❤","❤赞一个❤"];
var oSpan = $("<span></span>").text(arr[n]);
n = (n + 1) % arr.length;
var x = e.pageX, y = e.pageY;
oSpan.css({
"z-index": 99,
"top": y - 20,
"left": x,
"position": "absolute",
"font-weight": "bold",
"color": "rgb("+(255*Math.random())+","+(255Math.random())+","+~~(255Math.random())+")"
});
$("body").append(oSpan);
oSpan.animate({
"top": y - 180,
"opacity": 0
}, 1500, function() {
oSpan.remove();
});
});
</script>

评论 ( 0 )
最新评论
暂无评论

赶紧努力消灭 0 回复