Skip to content

Instantly share code, notes, and snippets.

@binjoo
Created March 5, 2018 01:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binjoo/12d68ff252a4b5e8e0bae1fda0410927 to your computer and use it in GitHub Desktop.
Save binjoo/12d68ff252a4b5e8e0bae1fda0410927 to your computer and use it in GitHub Desktop.
点击回血特效
$("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": "#40aa52"
});
$("body").append($i);
$i.animate({
"top": y - 180,
"opacity": 0
},
1500,
function() {
$i.remove()
});
e.stopPropagation()
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment