1/***** 2 3Image Cross Fade Redux 4Version 1.0 5Last revision: 02.15.2006 6[email protected] 7 8Please leave this notice intact. 9 10Rewrite of old code found here: http://slayeroffice.com/code/imageCrossFade/index.html 11 12 13*****/ 14 15 16window.addEventListener?window.addEventListener("load",so_init,false):window.attachEvent("onload",so_init); 17 18var d=document, imgs = new Array(), zInterval = null, current=0, pause=false; 19 20function so_init() { 21 if(!d.getElementById || !d.createElement)return; 22 23 // DON'T FORGET TO GRAB THIS FILE AND PLACE IT ON YOUR SERVER IN THE SAME DIRECTORY AS THE JAVASCRIPT! 24 // http://slayeroffice.com/code/imageCrossFade/xfade2.css 25 css = d.createElement("link"); 26 css.setAttribute("href","xfade2.css"); 27 css.setAttribute("rel","stylesheet"); 28 css.setAttribute("type","text/css"); 29 d.getElementsByTagName("head")[0].appendChild(css); 30 31 imgs = d.getElementById("imageContainer").getElementsByTagName("img"); 32 for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0; 33 imgs[0].style.display = "block"; 34 imgs[0].xOpacity = .99; 35 36 setTimeout(so_xfade,4000); 37} 38 39function so_xfade() { 40 cOpacity = imgs[current].xOpacity; 41 nIndex = imgs[current+1]?current+1:0; 42 43 nOpacity = imgs[nIndex].xOpacity; 44 45 cOpacity-=.05; 46 nOpacity+=.05; 47 48 imgs[nIndex].style.display = "block"; 49 imgs[current].xOpacity = cOpacity; 50 imgs[nIndex].xOpacity = nOpacity; 51 52 setOpacity(imgs[current]); 53 setOpacity(imgs[nIndex]); 54 55 if(cOpacity<=0) { 56 imgs[current].style.display = "none"; 57 current = nIndex; 58 setTimeout(so_xfade,4000); 59 } else { 60 setTimeout(so_xfade,50); 61 } 62 63 function setOpacity(obj) { 64 if(obj.xOpacity>.99) { 65 obj.xOpacity = .99; 66 return; 67 } 68 obj.style.opacity = obj.xOpacity; 69 obj.style.MozOpacity = obj.xOpacity; 70 obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")"; 71 } 72 73}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.