标签:
//fadeOut //function start function fadeOut(ele,speed){ var ele=document.getElementById(ele); var opacitynum=ele.style.opacity||1; var speed=(speed/100)||10; function opacityOff(){ if(opacitynum>0){ ele.style.opacity=opacitynum=(opacitynum-0.01).toFixed(2); }else{ clearInterval(opacityt); } } var opacityt=setInterval(opacityOff,speed); } //function end //fadeIn //function start function fadeIn(ele,speed){ var ele=document.getElementById(ele); var opacitynum=ele.style.opacity||0; var speed=(speed/100)||10; function opacityAdd(){ if(opacitynum<1){ ele.style.opacity=opacitynum=(parseFloat(opacitynum)+0.01).toFixed(2); }else{ clearInterval(opacityt); } } var opacityt=setInterval(opacityAdd,speed); } //function end
Javascript渐隐渐入渐出效果 fadeOut fadeIn
标签:
原文地址:http://www.cnblogs.com/sunbey/p/5134516.html