Created
May 20, 2015 22:15
-
-
Save LulzAugusto/533347f462ab265326df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fadeOut(el){ | |
el.style.opacity = 1; | |
(function fade() { | |
el.style.opacity -= 0.1; | |
if (el.style.opacity < 0) { | |
el.style.display = "none"; | |
el.classList.add('tago-playerbox-hide'); | |
} else { | |
requestAnimationFrame(fade); | |
} | |
})(); | |
} | |
function fadeIn(el, display){ | |
if (el.classList.contains('tago-playerbox-hide')){ | |
el.classList.remove('tago-playerbox-hide'); | |
} | |
el.style.opacity = 0; | |
el.style.display = display || "block"; | |
(function fade() { | |
var val = parseFloat(el.style.opacity); | |
if (((val += 0.2) < 1)) { | |
el.style.opacity = val; | |
requestAnimationFrame(fade); | |
} | |
})(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment