|
- <body>
' ^3 ] Z+ o# Q* g+ K9 X9 B - <script>
4 @$ u4 ]3 \9 L - !function(e, t, a) { 9 {# Z* a( h- G2 f- l O" }* p- s
- function r() { 1 M! u: i' y- T1 k b7 K! V
- for (var e = 0; e < s.length; e++)! E* v0 k. W& R# H/ B
- s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[e].x + "px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale + "," + s[e].scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999");
0 M ~9 S! t0 ]& q( ? - requestAnimationFrame(r)
1 L$ Q& w/ J* T - } . n/ i7 I5 k/ e
- function n() { - o3 T+ J" U+ k' o, r& P( p; _' S
- var t = "function" == typeof e.onclick && e.onclick;
" f. E1 {0 l# X- V& G0 A - e.onclick = function(e) { , m a6 Z8 A; R/ v3 R7 \4 u
- t && t(),
( l y+ e3 @& E9 J: V9 R+ U& y- v - o(e) # ^2 S9 v1 t* B) O+ U" H
- }
N+ P" q4 U$ o( [+ L - }
1 O$ w# x1 B& p9 a3 m- S1 u - function o(e) { ! N; d( y' Z: Q3 W0 W
- var a = t.createElement("div"); 7 X* f T% y- c2 v& C! U U. @
- a.className = "heart", 4 N7 K! e8 s$ C5 w9 L! g+ q
- s.push({ 6 f. [; r2 h k+ l" V4 G
- el: a,
( R8 [ n7 @- m6 Y* Z O) e - x: e.clientX - 5,
t& }: M0 _6 B4 o2 K - y: e.clientY - 5, t* ]! {2 Z9 b% _1 W0 N) [* P' s- `
- scale: 1,
$ ~# L9 t: ~! m r8 r - alpha: 1,
' I0 y ?5 J* j" w - color: c() & U/ t1 e* B! T" K9 T
- }), ( e5 y2 Z1 M; }( G E
- t.body.appendChild(a) $ {6 l o S& i' L% B5 n
- } ! |# G0 m+ B* k2 m# g5 n6 `% n1 ]
- function i(e) {
9 t# a7 ~1 j5 Q& n$ k2 c9 p& `8 H$ C - var a = t.createElement("style");
( G, M: l2 E' u @( v - a.type = "text/css"; $ B ` F" _. s8 {1 \6 U& D/ U
- try { 8 @8 |; D' n0 [7 {- m
- a.appendChild(t.createTextNode(e)) ) n. Z: X! T$ W ~" ?" z8 y+ |
- } catch(t) {
( H6 C0 Q- O. U' j, L - a.styleSheet.cssText = e + j1 U/ v) R( ^. n: N: k
- } ) D. ]+ ~# p/ Z
- t.getElementsByTagName("head")[0].appendChild(a)
8 P- X. {0 v$ x8 W0 o4 y - }
3 v$ n: _8 P) N& i - function c() {
`5 `* ~0 n) ~) N9 Y6 b. q - return "rgb(" + ~~ (255 * Math.random()) + "," + ~~ (255 * Math.random()) + "," + ~~ (255 * Math.random()) + ")" ! q* B/ g. b* d) ], j
- } ( Q* m" A6 ^7 n, i/ N5 g
- var s = []; ' i! W4 F1 E. M" P$ v# @
- e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function(e) { setTimeout(e, 1e3 / 60) }, 1 G2 l" j" {7 x3 b/ l
- i(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"), 2 p" B- E' o9 q
- n(),
) Z# q6 E1 w0 f - r()
, f- \" w, O6 F+ Z2 y - } (window, document); , G& k y2 Z! P3 |- J3 F( @
- </script>
( g% P9 M- q, [! _- O5 o - </body>
复制代码 |
|