Created
June 6, 2014 15:18
-
-
Save dillonhafer/8bbe1d52e0b76237f2cb to your computer and use it in GitHub Desktop.
Darling Duffy
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
document.addEventListener('DOMContentLoaded', function(){ | |
function fadeIn(el) { | |
el.style.opacity = 0; | |
var last = +new Date(); | |
var tick = function() { | |
el.style.opacity = +el.style.opacity + (new Date() - last) / 400; | |
last = +new Date(); | |
if (+el.style.opacity < 1) { | |
(window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16) | |
} | |
}; | |
tick(); | |
} | |
function HideNextSiblings(el) { | |
if (el.nextElementSibling) { | |
el.nextElementSibling.style.display = 'none'; | |
HideNextSiblings(el.nextElementSibling); | |
} | |
} | |
function ShowNextSiblings(el) { | |
if (el.nextElementSibling) { | |
el.nextElementSibling.style.display = ''; | |
fadeIn(el.nextElementSibling); | |
ShowNextSiblings(el.nextElementSibling); | |
} | |
} | |
var read_more = document.querySelector('.read-more-bio'); | |
if (read_more) { | |
HideNextSiblings(read_more.parentElement); | |
read_more.addEventListener('click', function(event) { | |
this.style.display = 'none'; | |
ShowNextSiblings(this.parentElement); | |
event.preventDefault(); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment