Based on this I made this:
<!DOCTYPE html>
<html lang="en">
<head>
<style type="text/css" media="all">
#accordion {
background-color: #EECCFF;
height: 200px;
width: 200px;
overflow-y: hidden;
max-height: 200px;
transition-property: all;
transition-duration: .5s;
}
#accordion.closed {
max-height: 0;
}
</style>
<title>Whatever</title>
</head>
<body>
<button onclick="act()">touch me</button>
<div id="accordion">Hi there!</div>
<script type="text/javascript">
function act() {
var accordion = document.getElementById('accordion');
accordion.classList.toggle('closed');
}
</script>
</body>
</html>
No comments:
Post a Comment