click.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // var a_idx = 0;
  2. // jQuery(document).ready(function($) {
  3. // $("body").click(function(e) {
  4. // // var a = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善");
  5. // var $i = $("<span/>").text(a[a_idx]);
  6. // a_idx = (a_idx + 1) % a.length;
  7. // var x = e.pageX,
  8. // y = e.pageY;
  9. // $i.css({
  10. // "z-index": 999999999999999999999999999999999999999999999999999999999999,
  11. // "top": y - 20,
  12. // "left": x,
  13. // "position": "absolute",
  14. // "color": "#ff0000",
  15. // "font-size": "20px",
  16. // "text-shadow": "0px 0px 5px #555"
  17. // });
  18. // $("body").append($i);
  19. // $i.animate({
  20. // "top": y - 300,
  21. // "opacity": 0
  22. // },
  23. // 1500,
  24. // function() {
  25. // $i.remove();
  26. // });
  27. // });
  28. // });
  29. $("html,body").click(function (e) {
  30. var gcd = new Array("♥", "♥", "♥");
  31. var n = Math.floor(Math.random() * gcd.length);
  32. var $i = $("<b/>").text(gcd[n]);
  33. var x = e.pageX,
  34. y = e.pageY;
  35. $i.css({
  36. "z-index": 99999,
  37. top: y - 20,
  38. left: x - 8,
  39. position: "absolute",
  40. color: "#FF706C",
  41. animation: "heartbeat .25s infinite .15s",
  42. });
  43. $("body").append($i);
  44. $i.animate(
  45. {
  46. opacity: 0,
  47. },
  48. 1500,
  49. function () {
  50. $i.remove();
  51. }
  52. );
  53. e.stopPropagation();
  54. });