Tumblr - Efeito de neve caindo no tumblr
Autor: Joyce Silva | Publicado: 2012-02-16T15:43:00-08:00

Aprenda a fazer nevar no seu tumblr...(Entre na página do post e espere ela carregar para ver o efeito)1º Passo) Copiar o código abaixo&lt;script type="text/javascript"&gt;// &lt;![CDATA[var speed=33; // lower number for fastervar flakes=100; // number of flakesvar colour="#639"; // colour of flakesvar slush=20; // set to '0' for no slush or otherwise set to height at which slush meltsvar flks=new Array();var flkx=new Array();var flky=new Array();var fldy=new Array();var slss=new Array();var slsh=new Array();var swide, shigh;window.onload=function() { if (document.getElementById) {&nbsp;&nbsp;var b, s;&nbsp;&nbsp;b=document.createElement("div");&nbsp;&nbsp;s=b.style;&nbsp;&nbsp;s.position="absolute";&nbsp;&nbsp;b.setAttribute("id", "bod");&nbsp;&nbsp;document.body.appendChild(b);&nbsp;&nbsp;set_scroll();&nbsp;&nbsp;set_width();&nbsp;&nbsp;for (var i=0; i&lt;flakes; i++) {&nbsp;&nbsp; &nbsp;flks[i]=createDiv(3, 3);&nbsp;&nbsp; &nbsp;flkx[i]=3*Math.floor(Math.random()*swide/3);&nbsp;&nbsp; &nbsp;flky[i]=Math.floor(Math.random()*shigh);&nbsp;&nbsp; &nbsp;fldy[i]=2+Math.floor(Math.random()*4);&nbsp;&nbsp; &nbsp;flks[i].style.left=flkx[i]+"px";&nbsp;&nbsp; &nbsp;flks[i].style.top=flky[i]+"px";&nbsp;&nbsp; &nbsp;b.appendChild(flks[i]);&nbsp;&nbsp;}&nbsp;&nbsp;setInterval("let_it_snow()", speed);}}function createDiv(height, width) {&nbsp;&nbsp;var div=document.createElement("div");&nbsp;&nbsp;div.style.position="absolute";&nbsp;&nbsp;div.style.height=height+"px";&nbsp;&nbsp;div.style.width=width+"px";&nbsp;&nbsp;div.style.overflow="hidden";&nbsp;&nbsp;div.style.backgroundColor=colour;&nbsp;&nbsp;return (div);}window.onresize=set_width;function set_width() {&nbsp;&nbsp;if (document.documentElement &amp;&amp; document.documentElement.clientWidth) {&nbsp;&nbsp; &nbsp;swide=document.documentElement.clientWidth;&nbsp;&nbsp; &nbsp;shigh=document.documentElement.clientHeight;&nbsp;&nbsp;}&nbsp;&nbsp;else if (typeof(self.innerHeight)=="number") {&nbsp;&nbsp; &nbsp;swide=self.innerWidth;&nbsp;&nbsp; &nbsp;shigh=self.innerHeight;&nbsp;&nbsp;}&nbsp;&nbsp;else if (document.body.clientWidth) {&nbsp;&nbsp; &nbsp;swide=document.body.clientWidth;&nbsp;&nbsp; &nbsp;shigh=document.body.clientHeight;&nbsp;&nbsp;}&nbsp;&nbsp;swide-=3;&nbsp;&nbsp;if (slush) {&nbsp;&nbsp; &nbsp;if (swide/3&gt;slss.length) for (var i=slss.length; i&lt;swide/3; i++) {&nbsp;&nbsp; &nbsp; &nbsp;slss[i]=createDiv(3, 3);&nbsp;&nbsp; &nbsp; &nbsp;slss[i].style.left=3*i+"px";&nbsp;&nbsp; &nbsp; &nbsp;document.getElementById("bod").appendChild(slss[i]);&nbsp;&nbsp; &nbsp; &nbsp;slsh[i]=3;&nbsp;&nbsp; &nbsp;}&nbsp;&nbsp; &nbsp;for (var i=0; i&lt;swide/3; i++) slss[i].style.top=shigh-slsh[i]+"px";&nbsp;&nbsp;}}window.onscroll=set_scroll;function set_scroll() {&nbsp;&nbsp;var sleft, sdown;&nbsp;&nbsp;if (typeof(self.pageYOffset)=="number") {&nbsp;&nbsp; &nbsp;sdown=self.pageYOffset;&nbsp;&nbsp; &nbsp;sleft=self.pageXOffset;&nbsp;&nbsp;}&nbsp;&nbsp;else if (document.body.scrollTop || document.body.scrollLeft) {&nbsp;&nbsp; &nbsp;sdown=document.body.scrollTop;&nbsp;&nbsp; &nbsp;sleft=document.body.scrollLeft;&nbsp;&nbsp;}&nbsp;&nbsp;else if (document.documentElement &amp;&amp; (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {&nbsp;&nbsp; &nbsp;sleft=document.documentElement.scrollLeft; sdown=document.documentElement.scrollTop;&nbsp;&nbsp;}&nbsp;&nbsp;else {&nbsp;&nbsp; &nbsp;sdown=0;&nbsp;&nbsp; &nbsp;sleft=0;&nbsp;&nbsp;}&nbsp;&nbsp;var s=document.getElementById("bod").style;&nbsp;&nbsp;s.top=sdown+"px";&nbsp;&nbsp;s.left=sleft+"px";}function let_it_snow(c) {&nbsp;&nbsp;var i, x, o=0;&nbsp;&nbsp;for (i=0; i&lt;flakes; i++) {&nbsp;&nbsp; &nbsp;flky[i]+=fldy[i]; x=flkx[i]/3;&nbsp;&nbsp; &nbsp;if (slush) o+=slsh[x];&nbsp;&nbsp; &nbsp;if (flky[i]&gt;=shigh-(slush?slsh[x]:0)) { &nbsp;&nbsp;if (slush) {&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (x&lt;swide &amp;&amp; slsh[x]&gt;slsh[x+1]+3) x++;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;else if (x&gt;0 &amp;&amp; slsh[x]&gt;slsh[x-1]+3) x--;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;slss[x].style.top=shigh-(slsh[x]+=3)+"px";&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;slss[x].style.height=slsh[x]+"px";&nbsp;&nbsp; &nbsp; &nbsp;} &nbsp;&nbsp;flky[i]=0; &nbsp;&nbsp;fldy[i]=2+Math.floor(Math.random()*4); &nbsp;&nbsp;flkx[i]=3*Math.floor(Math.random()*swide/3); &nbsp;&nbsp;flks[i].style.left=flkx[i]+"px"; } flks[i].style.top=flky[i]+"px";&nbsp;&nbsp;}&nbsp;&nbsp;if (o&gt;flakes*slush) {&nbsp;&nbsp; &nbsp;for (i=0; i&lt;swide/3; i++) if (slsh[i]&gt;1) slsh[i]--;&nbsp;&nbsp; &nbsp;set_width();&nbsp;&nbsp;}}// ]]&gt;&lt;/script&gt;2º Passo) Editar o código. MUITO CUIDADO AO ALTERAR O CÓDIGOAltere o número em :vermelho&nbsp;&nbsp; &nbsp;de &nbsp;var speed=33;&nbsp;. Quanto menor o número maior será a velocidade.roxo &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;de&nbsp;var flakes=100;&nbsp;Esse número representa a quantidade de flocos de neve.laranja &nbsp; &nbsp; &nbsp; &nbsp;de&nbsp;var slush=20;&nbsp;Esse número representa a quantidade de neve que ficará "acumulada" na parte de baixo da tela, coloque 0 caso não queira que a neve se acumule.Para alterar a cor dos flocos de neve basta mudar o código em&nbsp;azul&nbsp;de&nbsp;var colour="#639",&nbsp;pelo código HTML da cor que você quer. Visite esse site&nbsp;http://www.mxstudio.com.br/Conteudos/Dreamweaver/Cores.htm&nbsp;para ver os códigos das cores.3º Passo) Copiar o código editado e ir no Tumblr &gt;&gt; Customize &gt;&gt; Theme &gt;&gt; Custom HTML &gt;&gt; cole o código imediatamente antes de&nbsp;&lt;/body&gt;&nbsp;( Use CTRL F para achar mais facilmente).