RyoSugimoto
10/10/2014 - 5:14 AM

要素をフェードインさせる関数。

要素をフェードインさせる関数。

function fadeIn (elm) {
	var last = +new Date();
	elm.style.opacity = 0;
	tick();
	function tick () {
		elm.style.opacity = +el.style.opacity + (new Date() - last) / 400;
		last = +new Date();
		if (+elm.style.opacity < 1) {
			(window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);
		}
	}
}