Last active
August 29, 2015 14:26
-
-
Save not-inept/0d25cacaf7d8d928813b 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<style> | |
.accordion { | |
border: 1px solid; | |
transition: height 1.4s ease; | |
} | |
.accordion .box { | |
overflow: hidden; | |
} | |
.accordion .box .bellows { | |
height: 0px; | |
transition: height .2s ease-in; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="accordion"> | |
<p>wowee aren't I cool? o.O</p> | |
<div class="box"> | |
<div class="bellows"><p>It's a shame you hid me like that!</p></div> | |
</div> | |
</div> | |
<div class="accordion"> | |
<p>wowee aren't I cool? o.O</p> | |
<div class="box"> | |
<div class="bellows"><p>It's a shame you hid me like that!</p></div> | |
</div> | |
</div> | |
<div class="accordion"> | |
<p>wowee aren't I cool? o.O</p> | |
<div class="box"> | |
<div class="bellows"><p>It's a shame you hid me like that!</p></div> | |
</div> | |
</div> | |
<!-- <a href="tel:+15132603292;postd=p1p2p3p4p5p6p7p8">WOOTRY</a> --> | |
<script> | |
var playAccordion = function(self) { | |
var t = self; | |
var bb = t.getElementsByClassName('bellows')[0]; | |
var b = t.getElementsByClassName('box')[0]; | |
console.log(bb.style.height); | |
if (bb.style.height == "0px" || bb.style.height == "") { | |
bb.style.height = "2em"; | |
} else { | |
bb.style.height = "0px"; | |
} | |
} | |
var accordions = document.getElementsByClassName('accordion'); | |
for (var ti = 0; ti < accordions.length; ++ti) { | |
accordions[ti].onclick = function() { | |
playAccordion(this); | |
} | |
} | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment