website diff scripts/slideshow.js @ rev 731
Add get_feed.php and CSS for feedbox
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Jan 14 04:49:24 2011 +0100 (2011-01-14) |
parents | |
children | 4123d64d7e06 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/scripts/slideshow.js Fri Jan 14 04:49:24 2011 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 + 1.5 +window.addEventListener?window.addEventListener('load',so_init,false):window.attachEvent('onload',so_init); 1.6 + 1.7 +var d=document, imgs = new Array(), zInterval = null, current=0, pause=false; 1.8 + 1.9 +function so_init() 1.10 +{ 1.11 + if(!d.getElementById || !d.createElement)return; 1.12 + 1.13 + css = d.createElement('link'); 1.14 + css.setAttribute('href','slideshow.css'); 1.15 + css.setAttribute('rel','stylesheet'); 1.16 + css.setAttribute('type','text/css'); 1.17 + d.getElementsByTagName('head')[0].appendChild(css); 1.18 + 1.19 + imgs = d.getElementById('slideshow').getElementsByTagName('img'); 1.20 + for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0; 1.21 + imgs[0].style.display = 'block'; 1.22 + imgs[0].xOpacity = .99; 1.23 + 1.24 + setTimeout(so_xfade,4000); 1.25 +} 1.26 + 1.27 +function so_xfade() 1.28 +{ 1.29 + cOpacity = imgs[current].xOpacity; 1.30 + nIndex = imgs[current+1]?current+1:0; 1.31 + nOpacity = imgs[nIndex].xOpacity; 1.32 + 1.33 + cOpacity-=.05; 1.34 + nOpacity+=.05; 1.35 + 1.36 + imgs[nIndex].style.display = 'block'; 1.37 + imgs[current].xOpacity = cOpacity; 1.38 + imgs[nIndex].xOpacity = nOpacity; 1.39 + 1.40 + setOpacity(imgs[current]); 1.41 + setOpacity(imgs[nIndex]); 1.42 + 1.43 + if(cOpacity<=0) 1.44 + { 1.45 + imgs[current].style.display = 'none'; 1.46 + current = nIndex; 1.47 + setTimeout(so_xfade,4000); 1.48 + } 1.49 + else 1.50 + { 1.51 + setTimeout(so_xfade,60); 1.52 + } 1.53 + 1.54 + function setOpacity(obj) 1.55 + { 1.56 + if(obj.xOpacity>.99) 1.57 + { 1.58 + obj.xOpacity = .99; 1.59 + return; 1.60 + } 1.61 + 1.62 + obj.style.opacity = obj.xOpacity; 1.63 + obj.style.MozOpacity = obj.xOpacity; 1.64 + obj.style.filter = 'alpha(opacity=' + (obj.xOpacity*100) + ')'; 1.65 + } 1.66 +}