cómo hacer caer la nieve para tu blog o para tu sitio web:
para esto tendremos que poner el script:
<script type = "text / javascript">
// <! [CDATA [
// Snow en el blog
/ ** @license
DHTML Snowstorm! JavaScript basado en Snow para páginas web
------------------------------------------- -------------
Versión 1.42.20111120 (Revolución anterior: 1.41.20101113)
Copyright (c) 2007, Scott Schiller. Todos los derechos reservados
Código provisto bajo la Licencia BSD:
http://schillmania.com/projects/snowstorm/license.txt
* /
Tormenta de nieve (, e d) var = función {función g (a, d) {isNaN (d) && (d = 0); Math.random () * + d} volver a la función () {e.setTimeout (función () {a.Inicie (verdadero)}, 20); a.events.remove (r d:! e, "mousemove" a) r} function () {if (a.excludeMobile || s) ? .freezeOnBlur a.events.add (r d: e, "mouseMove" a) o (); a.events.remove (y "carga", r)} this.flakesMax = 250; this.flakesMaxActive = 250; this.animationInterval = 0; this.excludeMobile = true; this.flakeBottom = null; this.followMouse = true; this.snowColor = "# ffffff"; this.snowCharacter = "& bull;" this.snowStick = true ;
this.targetElement = null; this.useMeltEffect = true; this.usePositionFixed this.useTwinkleEffect = = false; this.freezeOnBlur = true; this.flakeRightOffset this.flakeLeftOffset = = 0 = this.flakeHeight this.flakeWidth = 8; esto. vMaxX = 5; this.vMaxY = 4; this.zIndex = 0; var a = este, y = este, i = navigator.userAgent.match (/ MSIE / i), z = navigator.userAgent.match (/ 6 MSIE /i),A=navigator.appVersion.match(/windows 98 / i) = s navigator.userAgent.match (/ móvil / i), B = i && d.compatMode === "BackCompat" t = s || B || z, h = null, null = k, j = null, null = m, u = null, v = null,
p = 1, n = false, q; la {. try {d.createElement ( "div") style.opacity = "0.5"} catch (C) {q = false;} descanso en q = true} var w = false, x = d.createDocumentFragment (); this.timers = []; this.flakes = [] = this.active this.disabled = false; this.meltFrameCount = 20; this.meltFrames = []; esto. eventos = function () {función a (b) {var b = f.call (b), c = b.length;? l (b [1] = "on" + b [1], c> 3 && b.pop ()) && c 3 === b.push (false); retorno de la función b} d (a, c) {var e = a.shift () = f [b [c]]; si (L) y [ f] (a [0], una [1]);! else y [f] .apply (y)} var s = && e.addEventListener e.attachEvent, f = Array.prototype.slice,
b = {añadir: l "attachEvent" "addEventListener", retirar:? l "? detachEvent" "removeEventListener"} retorno {añadir: function () {for (los (argumentos), "añadir")}, eliminar : function () {for (los (argumentos) "REMOVE")}}} (); this.randomizeWind = function () {var c, c = g (a.vMaxX, 0,2); u = parseInt (g ( 2) 10) === 1 -1 * c:? c; v = g (a.vMaxY, 0,2); if (this.flakes) para (c = 0; c <this.flakes.length; c ++) this.flakes [c] && .active this.flakes [c] .setVelocities ()}; this.scrollHandler = function () {var c = a.flakeBottom m 0: parseInt (e.scrollY d.documentElement.scrollTop || || d.body.scrollTop,
10) isNaN (m) && (m = 0), si (N && && a.flakeBottom a.flakes) para (c = a.flakes.length c -;!) A.flakes [c] == .active = 0 && a.flakes [c] .stick ()}; this.resizeHandler = function () {|| e.innerWidth e.innerHeight (h = e.innerWidth - (i 16:??? 16) -a.flakeRightOffset, ? j = a.flakeBottom a.flakeBottom: e.innerHeight) :( = h (d.documentElement.clientWidth d.body.clientWidth || || d.body.scrollWidth) - (y 8:?? 0) -a ? .flakeRightOffset, j = a.flakeBottom a.flakeBottom: d.documentElement.clientHeight || || d.body.clientHeight d.body.scrollHeight); k = parseInt (h / 2,10)} = this.resizeHandlerAlt
function () {h = + a.targetElement.offsetLeft a.targetElement.offsetWidth-a.flakeRightOffset; j = a.flakeBottom a.flakeBottom:? a.targetElement.offsetTop a.targetElement.offsetHeight + k = parseInt (h / 2,10)}; this.freeze = function () {var c; si (a.disabled) return false; otro a.disabled = 1; para (c = a.timers.length c -;) clearInterval ( a.timers [c])}; this.resume = function () {if (a.disabled) a.disabled = 0; otro return false; a.timerInit ()}; this.toggleSnow = function () {a. flakes.length? (= a.active! a.active, a.active? (a.show () a.resume ()) :( a.stop ()
a.freeze ())): a.Inicie ()}; this.stop = function () {var c; this.freeze (); para (c = this.flakes.length c -;) this.flakes [c] .o.style.display = "none"; a.events.remove (y "scroll", a.scrollHandler) a.events.remove (y "cambiar el tamaño de" a.resizeHandler) a. freezeOnBlur && (R (a.events.remove (d, "focusOut" a.freeze) a.events.remove (d, "focusIn" a.resume)) :( a.events.remove (y " difuminar "a.freeze) a.events.remove (y", a.resume)))} foco"; this.show = function () {var a; para (a = this.flakes.length; la -;) this.flakes [a] .o.style.display = "bloque"} = this.SnowFlake
función (a, e, l, f) {var = b este; this.type = e;! l || this.x = parseInt (g (h-20), 10) = this.y isNaN (f) ? f -g (j) -12; this.vY this.vX = = null; this.vAmpTypes = [1,1.2,1.4,1.6,1.8] = this.vAmp this.vAmpTypes [this.type]; this.melting = false; this.meltFrameCount a.meltFrameCount =; = this.meltFrames a.meltFrames; this.twinkleFrame this.meltFrame = = 0; this.active = 1; = 10 + this.fontSize this.type / 5 * 10; this.o d.createElement = ( 'div'); this.o.innerHTML a.snowCharacter =; = this.o.style.color a.snowColor; n = this.o.style.position "fijo"? "absoluta"; this.o.style.width =
a.flakeWidth + "px"; this.o.style.height a.flakeHeight = + "px"; this.o.style.fontFamily = "Arial, Verdana;" this.o.style.overflow = "oculto"; esto. o.style.fontWeight = "normal"; this.o.style.zIndex = a.zIndex; x.appendChild (this.o) This.Refresh = function () {if (isNaN (bX) || isNaN (por )) return false; bostyle.left b.x = + "px"; bostyle.top b.y = + "px"};! this.stick = function () {t || a.targetElement == && d.documentElement a.targetElement ! == d.body? bostyle.top = j + ma.flakeHeight + "px" a.flakeBottom? bostyle.top a.flakeBottom = + "px" bostyle.display = :(
"None", bostyle.top = "auto", bostyle.bottom = "0px" bostyle.position = "fijo", bostyle.display = "bloque")}; this.vCheck = function () {if (b. vX> = 0 && b.vX <0,2) b.vX = 0,2; else if (b.vX <0 && b.vX> -0,2) = -0,2 b.vX; si (b.vY> = 0 && b.vY <0,2) b xy = 0,2}; this.move = function () {var d = b.vX * p; b.x + = d; b.y + = * b.vY b.vAmp; si (bx> = h || hb .x <a.flakeWidth) bX = 0; else if (d <0 && b.xa.flakeLeftOffset <-a.flakeWidth) bX = ha.flakeWidth-1; b.refresh (); si (j + mb.y <a ? .flakeHeight) b.active = 0, a.snowStick b.stick (): b.recycle (); else {si (a.useMeltEffect && && b.active
b.type <3 && && b.melting Math.random ()!> 0998) b.melting = true, b.melt (), si (a.useTwinkleEffect) si (b.twinkleFrame) b.twinkleFrame - bostyle.visibility = b.twinkleFrame && b.twinkleFrame === 0% 2 "oculto", "visible";? else if (Math.random ()> 0,9) b.twinkleFrame = parseInt (Math.random () * 20.10)}}; this.animate = function () {b.move ()}; this.setVelocities = function () {b.vX = u + g (* a.vMaxX 0.12,0.1) b.vY = v + g (a. vMaxY 0.12,0.1 *)}; this.setOpacity = function (a, b) {if (q) return false;!} a.style.opacity = b; this.melt = function () {a.useMeltEffect ||! ! b.melting?
b.recycle ():? b.meltFrame <b.meltFrameCount (b.meltFrame ++, b.setOpacity (bueno, b.meltFrames [b.meltFrame]) = bostyle.fontSize b.fontSize-b.fontSize * (b. meltFrame / b.meltFrameCount) + "px" bostyle.lineHeight a.flakeHeight = + 2 + a.flakeHeight * 0,75 * (b.meltFrame / b.meltFrameCount) + "px"): b.recycle ()}; este .recycle = function () {bostyle.display = "None"; n = bostyle.position "fijo", "absolutos";? bostyle.bottom = "auto"; b.setVelocities (); b.vCheck (b) .meltFrame = 0; b.melting = false; b.setOpacity (bueno, 1); bostyle.padding = "0px"; bostyle.margin =
"0px"; bostyle.fontSize b.fontSize = + "px"; bostyle.lineHeight a.flakeHeight = + 2 + "px"; bostyle.textAlign = "centro"; bostyle.verticalAlign = "línea base" bx = parseInt (g (ha.flakeWidth-20), 10), por = parseInt (g (j) * - 1,10) -a.flakeHeight; b.refresh (); bostyle.display = "bloque"; b.active = 1} ; this.recycle (); This.Refresh ()}; this.snow = function () {for (var c = 0, d = 0, y = 0, f = null, f = f a.flakes.length -;) a.flakes [f] === .active 1 (a.flakes [f] .Llevar (), c ++) a.flakes [f] .active === 0 d ++: ++ y los?? .flakes [f] && .melting a.flakes [f] .melt (); si (c <&& a.flakesMaxActive
(F = a.flakes [parseInt (g (a.flakes.length), 10)], === f.active 0)) f.melting = true}; this.mouseMove = function (c) {if (! a.followMouse) return true; c = parseInt (c.clientX, 10);? c <k p = -2 + c / k * 2 (c = k, p = c / k * 2)}; este .createSnow = function (c, d) {var e; para (e = 0 y <c, y ++) si (a.flakes [a.flakes.length] = new a.SnowFlake (a, parseInt (g (6 ), 10)), y d ||> a.flakesMaxActive) a.flakes [a.flakes.length-1] = -1 .active; y.targetElement.appendChild (x)}; this.timerInit = function () {a.timers =! A? [setInterval (a.snow, a.animationInterval)]: [setInterval (a.snow, a.animationInterval *
3) setInterval (a.snow, a.animationInterval)]}; this.init = function () {var c; para (c = 0; c <a.meltFrameCount; c ++) a.meltFrames.push (1-c /a.meltFrameCount);a.randomizeWind();a.createSnow(a.flakesMax);a.events.add(e,"resize",a.resizeHandler);a.events.add(e,"scroll " a.scrollHandler) a.freezeOnBlur && (R (a.events.add (d, "focusOut" a.freeze) a.events.add (d, "focusIn" a.resume)) :( a. events.add (y "desenfoque", a.freeze) a.events.add (y "enfoque", a.resume))); a.resizeHandler (); a.scrollHandler () && a.followMouse a. events.add (i? d: e, "mousemove",
a.mouseMove) = a.animationInterval Math.max (20 a.animationInterval) a.timerInit ()}; this.start = function (c) {if (w) {if (c) devolver true} else w = true; si (a.targetElement typeof === "cadena" && (c = a.targetElement, a.targetElement d.getElementById = (c) a.targetElement,)!) error de tiro ( 'Tormenta de nieve: No se puede obtener targetElement " '+ c +'" '), si (a.targetElement) a.targetElement = i d.documentElement d.documentElement: d.body:???! d.body; si (== a.targetElement && a d.documentElement ! == .targetElement d.body) = a.resizeHandler a.resizeHandlerAlt;
a.resizeHandler () = a.usePositionFixed a.usePositionFixed && t n = a.usePositionFixed; if (! h j && && a.disabled!) A. En () a.active = true}; a.events.add (y , "carga", r, false);} devolver este (ventana, documento);
//]]>
</ script>
// <! [CDATA [
// Snow en el blog
/ ** @license
DHTML Snowstorm! JavaScript basado en Snow para páginas web
------------------------------------------- -------------
Versión 1.42.20111120 (Revolución anterior: 1.41.20101113)
Copyright (c) 2007, Scott Schiller. Todos los derechos reservados
Código provisto bajo la Licencia BSD:
http://schillmania.com/projects/snowstorm/license.txt
* /
Tormenta de nieve (, e d) var = función {función g (a, d) {isNaN (d) && (d = 0); Math.random () * + d} volver a la función () {e.setTimeout (función () {a.Inicie (verdadero)}, 20); a.events.remove (r d:! e, "mousemove" a) r} function () {if (a.excludeMobile || s) ? .freezeOnBlur a.events.add (r d: e, "mouseMove" a) o (); a.events.remove (y "carga", r)} this.flakesMax = 250; this.flakesMaxActive = 250; this.animationInterval = 0; this.excludeMobile = true; this.flakeBottom = null; this.followMouse = true; this.snowColor = "# ffffff"; this.snowCharacter = "& bull;" this.snowStick = true ;
this.targetElement = null; this.useMeltEffect = true; this.usePositionFixed this.useTwinkleEffect = = false; this.freezeOnBlur = true; this.flakeRightOffset this.flakeLeftOffset = = 0 = this.flakeHeight this.flakeWidth = 8; esto. vMaxX = 5; this.vMaxY = 4; this.zIndex = 0; var a = este, y = este, i = navigator.userAgent.match (/ MSIE / i), z = navigator.userAgent.match (/ 6 MSIE /i),A=navigator.appVersion.match(/windows 98 / i) = s navigator.userAgent.match (/ móvil / i), B = i && d.compatMode === "BackCompat" t = s || B || z, h = null, null = k, j = null, null = m, u = null, v = null,
p = 1, n = false, q; la {. try {d.createElement ( "div") style.opacity = "0.5"} catch (C) {q = false;} descanso en q = true} var w = false, x = d.createDocumentFragment (); this.timers = []; this.flakes = [] = this.active this.disabled = false; this.meltFrameCount = 20; this.meltFrames = []; esto. eventos = function () {función a (b) {var b = f.call (b), c = b.length;? l (b [1] = "on" + b [1], c> 3 && b.pop ()) && c 3 === b.push (false); retorno de la función b} d (a, c) {var e = a.shift () = f [b [c]]; si (L) y [ f] (a [0], una [1]);! else y [f] .apply (y)} var s = && e.addEventListener e.attachEvent, f = Array.prototype.slice,
b = {añadir: l "attachEvent" "addEventListener", retirar:? l "? detachEvent" "removeEventListener"} retorno {añadir: function () {for (los (argumentos), "añadir")}, eliminar : function () {for (los (argumentos) "REMOVE")}}} (); this.randomizeWind = function () {var c, c = g (a.vMaxX, 0,2); u = parseInt (g ( 2) 10) === 1 -1 * c:? c; v = g (a.vMaxY, 0,2); if (this.flakes) para (c = 0; c <this.flakes.length; c ++) this.flakes [c] && .active this.flakes [c] .setVelocities ()}; this.scrollHandler = function () {var c = a.flakeBottom m 0: parseInt (e.scrollY d.documentElement.scrollTop || || d.body.scrollTop,
10) isNaN (m) && (m = 0), si (N && && a.flakeBottom a.flakes) para (c = a.flakes.length c -;!) A.flakes [c] == .active = 0 && a.flakes [c] .stick ()}; this.resizeHandler = function () {|| e.innerWidth e.innerHeight (h = e.innerWidth - (i 16:??? 16) -a.flakeRightOffset, ? j = a.flakeBottom a.flakeBottom: e.innerHeight) :( = h (d.documentElement.clientWidth d.body.clientWidth || || d.body.scrollWidth) - (y 8:?? 0) -a ? .flakeRightOffset, j = a.flakeBottom a.flakeBottom: d.documentElement.clientHeight || || d.body.clientHeight d.body.scrollHeight); k = parseInt (h / 2,10)} = this.resizeHandlerAlt
function () {h = + a.targetElement.offsetLeft a.targetElement.offsetWidth-a.flakeRightOffset; j = a.flakeBottom a.flakeBottom:? a.targetElement.offsetTop a.targetElement.offsetHeight + k = parseInt (h / 2,10)}; this.freeze = function () {var c; si (a.disabled) return false; otro a.disabled = 1; para (c = a.timers.length c -;) clearInterval ( a.timers [c])}; this.resume = function () {if (a.disabled) a.disabled = 0; otro return false; a.timerInit ()}; this.toggleSnow = function () {a. flakes.length? (= a.active! a.active, a.active? (a.show () a.resume ()) :( a.stop ()
a.freeze ())): a.Inicie ()}; this.stop = function () {var c; this.freeze (); para (c = this.flakes.length c -;) this.flakes [c] .o.style.display = "none"; a.events.remove (y "scroll", a.scrollHandler) a.events.remove (y "cambiar el tamaño de" a.resizeHandler) a. freezeOnBlur && (R (a.events.remove (d, "focusOut" a.freeze) a.events.remove (d, "focusIn" a.resume)) :( a.events.remove (y " difuminar "a.freeze) a.events.remove (y", a.resume)))} foco"; this.show = function () {var a; para (a = this.flakes.length; la -;) this.flakes [a] .o.style.display = "bloque"} = this.SnowFlake
función (a, e, l, f) {var = b este; this.type = e;! l || this.x = parseInt (g (h-20), 10) = this.y isNaN (f) ? f -g (j) -12; this.vY this.vX = = null; this.vAmpTypes = [1,1.2,1.4,1.6,1.8] = this.vAmp this.vAmpTypes [this.type]; this.melting = false; this.meltFrameCount a.meltFrameCount =; = this.meltFrames a.meltFrames; this.twinkleFrame this.meltFrame = = 0; this.active = 1; = 10 + this.fontSize this.type / 5 * 10; this.o d.createElement = ( 'div'); this.o.innerHTML a.snowCharacter =; = this.o.style.color a.snowColor; n = this.o.style.position "fijo"? "absoluta"; this.o.style.width =
a.flakeWidth + "px"; this.o.style.height a.flakeHeight = + "px"; this.o.style.fontFamily = "Arial, Verdana;" this.o.style.overflow = "oculto"; esto. o.style.fontWeight = "normal"; this.o.style.zIndex = a.zIndex; x.appendChild (this.o) This.Refresh = function () {if (isNaN (bX) || isNaN (por )) return false; bostyle.left b.x = + "px"; bostyle.top b.y = + "px"};! this.stick = function () {t || a.targetElement == && d.documentElement a.targetElement ! == d.body? bostyle.top = j + ma.flakeHeight + "px" a.flakeBottom? bostyle.top a.flakeBottom = + "px" bostyle.display = :(
"None", bostyle.top = "auto", bostyle.bottom = "0px" bostyle.position = "fijo", bostyle.display = "bloque")}; this.vCheck = function () {if (b. vX> = 0 && b.vX <0,2) b.vX = 0,2; else if (b.vX <0 && b.vX> -0,2) = -0,2 b.vX; si (b.vY> = 0 && b.vY <0,2) b xy = 0,2}; this.move = function () {var d = b.vX * p; b.x + = d; b.y + = * b.vY b.vAmp; si (bx> = h || hb .x <a.flakeWidth) bX = 0; else if (d <0 && b.xa.flakeLeftOffset <-a.flakeWidth) bX = ha.flakeWidth-1; b.refresh (); si (j + mb.y <a ? .flakeHeight) b.active = 0, a.snowStick b.stick (): b.recycle (); else {si (a.useMeltEffect && && b.active
b.type <3 && && b.melting Math.random ()!> 0998) b.melting = true, b.melt (), si (a.useTwinkleEffect) si (b.twinkleFrame) b.twinkleFrame - bostyle.visibility = b.twinkleFrame && b.twinkleFrame === 0% 2 "oculto", "visible";? else if (Math.random ()> 0,9) b.twinkleFrame = parseInt (Math.random () * 20.10)}}; this.animate = function () {b.move ()}; this.setVelocities = function () {b.vX = u + g (* a.vMaxX 0.12,0.1) b.vY = v + g (a. vMaxY 0.12,0.1 *)}; this.setOpacity = function (a, b) {if (q) return false;!} a.style.opacity = b; this.melt = function () {a.useMeltEffect ||! ! b.melting?
b.recycle ():? b.meltFrame <b.meltFrameCount (b.meltFrame ++, b.setOpacity (bueno, b.meltFrames [b.meltFrame]) = bostyle.fontSize b.fontSize-b.fontSize * (b. meltFrame / b.meltFrameCount) + "px" bostyle.lineHeight a.flakeHeight = + 2 + a.flakeHeight * 0,75 * (b.meltFrame / b.meltFrameCount) + "px"): b.recycle ()}; este .recycle = function () {bostyle.display = "None"; n = bostyle.position "fijo", "absolutos";? bostyle.bottom = "auto"; b.setVelocities (); b.vCheck (b) .meltFrame = 0; b.melting = false; b.setOpacity (bueno, 1); bostyle.padding = "0px"; bostyle.margin =
"0px"; bostyle.fontSize b.fontSize = + "px"; bostyle.lineHeight a.flakeHeight = + 2 + "px"; bostyle.textAlign = "centro"; bostyle.verticalAlign = "línea base" bx = parseInt (g (ha.flakeWidth-20), 10), por = parseInt (g (j) * - 1,10) -a.flakeHeight; b.refresh (); bostyle.display = "bloque"; b.active = 1} ; this.recycle (); This.Refresh ()}; this.snow = function () {for (var c = 0, d = 0, y = 0, f = null, f = f a.flakes.length -;) a.flakes [f] === .active 1 (a.flakes [f] .Llevar (), c ++) a.flakes [f] .active === 0 d ++: ++ y los?? .flakes [f] && .melting a.flakes [f] .melt (); si (c <&& a.flakesMaxActive
(F = a.flakes [parseInt (g (a.flakes.length), 10)], === f.active 0)) f.melting = true}; this.mouseMove = function (c) {if (! a.followMouse) return true; c = parseInt (c.clientX, 10);? c <k p = -2 + c / k * 2 (c = k, p = c / k * 2)}; este .createSnow = function (c, d) {var e; para (e = 0 y <c, y ++) si (a.flakes [a.flakes.length] = new a.SnowFlake (a, parseInt (g (6 ), 10)), y d ||> a.flakesMaxActive) a.flakes [a.flakes.length-1] = -1 .active; y.targetElement.appendChild (x)}; this.timerInit = function () {a.timers =! A? [setInterval (a.snow, a.animationInterval)]: [setInterval (a.snow, a.animationInterval *
3) setInterval (a.snow, a.animationInterval)]}; this.init = function () {var c; para (c = 0; c <a.meltFrameCount; c ++) a.meltFrames.push (1-c /a.meltFrameCount);a.randomizeWind();a.createSnow(a.flakesMax);a.events.add(e,"resize",a.resizeHandler);a.events.add(e,"scroll " a.scrollHandler) a.freezeOnBlur && (R (a.events.add (d, "focusOut" a.freeze) a.events.add (d, "focusIn" a.resume)) :( a. events.add (y "desenfoque", a.freeze) a.events.add (y "enfoque", a.resume))); a.resizeHandler (); a.scrollHandler () && a.followMouse a. events.add (i? d: e, "mousemove",
a.mouseMove) = a.animationInterval Math.max (20 a.animationInterval) a.timerInit ()}; this.start = function (c) {if (w) {if (c) devolver true} else w = true; si (a.targetElement typeof === "cadena" && (c = a.targetElement, a.targetElement d.getElementById = (c) a.targetElement,)!) error de tiro ( 'Tormenta de nieve: No se puede obtener targetElement " '+ c +'" '), si (a.targetElement) a.targetElement = i d.documentElement d.documentElement: d.body:???! d.body; si (== a.targetElement && a d.documentElement ! == .targetElement d.body) = a.resizeHandler a.resizeHandlerAlt;
a.resizeHandler () = a.usePositionFixed a.usePositionFixed && t n = a.usePositionFixed; if (! h j && && a.disabled!) A. En () a.active = true}; a.events.add (y , "carga", r, false);} devolver este (ventana, documento);
//]]>
</ script>
No hay comentarios:
Publicar un comentario