Skip to content

Instantly share code, notes, and snippets.

@elentok
Created June 5, 2012 12:39
Show Gist options
  • Save elentok/2874729 to your computer and use it in GitHub Desktop.
Save elentok/2874729 to your computer and use it in GitHub Desktop.
Vertical Expander
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Boris Expander Example</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('a.vertical-expander').click(function(e) {
e.preventDefault();
var panel = $(this).next();
var newWidth = panel.width() ? 0 : 200;
panel.animate({width: newWidth}, 'fast');
$(this).toggleClass('open')
});
});
</script>
<style type="text/css">
.vertical-expander {
display: block;
float: left;
border: 1px solid #ccc;
background-color: #eee;
height: 250px;
}
.vertical-panel {
border: 1px solid #ccc;
height: 250px;
overflow-x: hidden;
width: 0px;
}
.vertical-panel > div {
width: 200px;
}
.vertical-expander.open {
font-weight: bold;
}
</style>
</head>
<body>
<div id="boris-panel">
<a href="#" class="vertical-expander">Expander</a>
<div class="vertical-panel">
<div>
Hello World!
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment