Доброго времени суток. Подготавливая форум к новому году, нашла у вас подхождящий скрипт со снежинками. Но появилась проблема - постоянно выскакивает гуляющая полоса ширины.
Сам скрипт:
<script type="text/javascript"><!-- var snowmax = 90; var snowcolor = new Array("#f0f8ff","#ffffff", "#bdc1d7", "#dee0ea"); var snowtype = new Array("Arial Black", "Arial Narrow", "Times", "Comic Sans MS"); var snowletter = "*"; var snowfps=16.666667; var k1decay=0.067; var snowmaxsize = 27; var snowminsize = 8; var snowcharsize = 10; var sinkspeed = 49; var snowingzoneleft = 0.0; var snowingzoneright = 1.0; var snowxvar=25; var snowminxfreq=0.5; var snowvarxfreq=1.6666667; var snowyvar=35; var snowminyfreq=0.25; var snowvaryfreq=0.8333333; var safetygap=28; var topfalltime=1.0; var snow = new Array(); var marginbottom; var marginright; var marginleft; var ScrollTop; var timer; var i_snow = 0; var snowtimestep=1000.0/snowfps; var snowdecayprob=k1decay/snowfps; var browserinfos = navigator.userAgent; var ie5 = document.all && document.getElementById && !browserinfos.match(/Opera/); var ns6 = document.getElementById && !document.all; var opera = browserinfos.match(/Opera/); var browserok = ie5 || ns6 || opera; function randommaker(a) { rand = Math.floor(a * Math.random()); return rand } function iecompattest() { return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body } function InitHeight() { if (ie5 || opera) { marginbottom = iecompattest().clientHeight + 5; //clientHeight; marginright = iecompattest().scrollWidth + 5; //clientWidth } else { if (ns6) { marginbottom = self.innerHeight; marginright = self.innerWidth } } ScrollTop = document.body.scrollTop; if (ScrollTop == 0) { if (window.pageYOffset) ScrollTop = window.pageYOffset; else ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0; } marginbottom += ScrollTop; marginleft=marginright*snowingzoneleft; marginright*=snowingzoneright; // GET CLEAR OF SCROLLBAR!!! marginbottom-=safetygap+snowmaxsize+snowyvar; marginright-=safetygap+snowmaxsize+snowxvar; marginleft+=snowmaxsize+snowxvar } function initsnow() { InitHeight() var a = snowmaxsize - snowminsize; for (i = 0;i < snowmax;i++) { snow[i] = document.getElementById("s" + i); snow[i].crds = 0; snow[i].ycrds = 0; snow[i].lftrght = Math.random() * snowxvar; snow[i].vertvar = Math.random() * snowyvar; snow[i].x_mv = ( snowminxfreq + snowvarxfreq*Math.random() ) / snowfps; snow[i].y_mv = ( snowminyfreq + snowvaryfreq*Math.random() ) / snowfps; snow[i].style.fontFamily = snowtype[randommaker(snowtype.length)]; snow[i].size = randommaker(a) + snowminsize; snow[i].style.fontSize = snow[i].size + "px"; snow[i].style.color = snowcolor[randommaker(snowcolor.length)]; var relsize = snow[i].size/snowcharsize; snow[i].sink = (sinkspeed/snowfps) * ( relsize>1 ? Math.sqrt(relsize) : relsize ); snow[i].posx = marginleft + randommaker(marginright - marginleft); snow[i].posy = ScrollTop + randommaker(marginbottom - ScrollTop); snow[i].style.left = snow[i].posx + "px"; snow[i].style.top = snow[i].posy + "px" } movesnow() } function movesnow() { InitHeight(); for (i = 0; i < snowmax; i++) { if (snow[i].posy >= marginbottom || snow[i].posy < (ScrollTop - topfalltime*snowfps*snow[i].sink) || Math.random() < snowdecayprob) { snow[i].posx = marginleft + randommaker(marginright - marginleft); var relaunchrand=Math.random(); snow[i].posy = ScrollTop - snowyvar + relaunchrand * relaunchrand * (marginbottom - ScrollTop ) } if(snow[i].posx<marginleft){ snow[i].posx+=(marginright-marginleft); } if(snow[i].posx>marginright){ snow[i].posx-=(marginright-marginleft); } snow[i].crds += snow[i].x_mv; snow[i].ycrds += snow[i].y_mv; snow[i].posy += snow[i].sink; snow[i].style.left = snow[i].posx + snow[i].lftrght * Math.sin(snow[i].crds) + "px"; snow[i].style.top = snow[i].posy + snow[i].vertvar * Math.sin(snow[i].ycrds) + "px"; } var a = setTimeout("movesnow()", snowtimestep) } function hidesnow() { if (window.timer) { clearTimeout(timer) } for (i = 0;i < snowmax;i++) { document.getElementById("s" + i).style.visibility = "hidden" } } for (i = 0;i < snowmax;i++) { document.write('<div id="s' + i + '" style="POSITION: absolute; Z-INDEX: 9' + i + "; VISIBILITY: visible; TOP:-" + snowmaxsize + 'px; LEFT: 15px;">' + snowletter + "</div>") } if (browserok) { initsnow() }// --> </script>
скрин проблемы:
Адрес ролевой: