用js实现fadeout有些看不懂,求知道.
function fadeout(ele, opacity, speed) { if (ele) { var v = ele.style.filter.replace("alpha(opacity=", "").replace(")", "") || ele.style.opacity || 100; v < 1 && (v = v * 100); var count = speed / 1000; var avg = (100 - opacity) / count; var timer = null; timer = setInterval(function() { if (v - avg > opacity) { v -= avg; setOpacity(ele, v); } else { clearInterval(timer); } }, 500); } }
_da
相关分类