jQuery界面点击出现文字
jQuery界面点击随机出现随机颜色社会主义核心价值观
jQuery(document).ready(function($) {
$("html,body").click(function(e) {
var chars = ['富强', '民主', '文明', '和谐', '自由', '平等', '公正', '法治', '爱国', '敬业', '诚信', '友善'];
var $i = $("<b/>").text(chars[Math.ceil(Math.random() * 12)]);
var x = e.pageX,
y = e.pageY;
$i.css({
"z-index": 99999,
"top": y - 20,
"left": x,
"position": "absolute",
"color": "rgb(" + parseInt(Math.random() * 255, 10) + "," + parseInt(Math.random() * 255, 10) + "," + parseInt(Math.random() * 255, 10) + ")"
});
$("body").append($i);
$i.animate({
"top": y - 180,
"opacity": 0
},
1500,
function() {
$i.remove();
});
e.stopPropagation();
});
});
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »