FadeIn / FadeOut without jQuery
$.fadeIn() / $.fadeOut() implementation without jQuery
Expand
function fadeOut(el_id, step)
var el = document.getElementById(el_id);
var start_opacity = el.style.opacity || 1,
current_opacity = el.style.opacity || 1,
var interval = setInterval(function() {
ie_val = (current_opacity * 100) - 5;
el.style.opacity = current_opacity;
el.style.filter = 'alpha(opacity=' + ie_val + ')';
if (current_opacity <= target_opacity)
el.style.opacity = target_opacity;
el.style.filter = 'alpha(opacity=' + (target_opacity * 100) + ')';
function fadeIn(el_id, step)
var el = document.getElementById(el_id);
var start_opacity = parseInt(el.style.opacity, 10) || 0.1,
current_opacity = parseInt(el.style.opacity, 10) || 0.1,
var interval3 = setInterval(function() {
ie_val = current_opacity * 100;
el.style.opacity = current_opacity;
el.style.filter = 'alpha(opacity=' + ie_val + ')';
if (current_opacity >= target_opacity)
clearInterval(interval3);
el.style.opacity = target_opacity;
el.style.filter = 'alpha(opacity=' + (target_opacity * 100) + ')';
function switchFade(el1, el2)