Created
June 5, 2012 12:20
-
-
Save elentok/2874673 to your computer and use it in GitHub Desktop.
Simple expander
This file contains 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" /> | |
<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() { | |
$('.expander-section').hide() | |
$('a.expander').click(function(e) { | |
e.preventDefault(); | |
$(this).next().slideToggle('fast') | |
$(this).toggleClass('open') | |
}); | |
}); | |
</script> | |
<style type="text/css"> | |
.expander { | |
display: block; | |
} | |
.expander.open { | |
font-weight: bold; | |
} | |
</style> | |
</head> | |
<body> | |
<a href="#" class="expander">Section 1</a> | |
<div class="expander-section"> | |
This is the contents of section 1 | |
</div> | |
<a href="#" class="expander">Section 2</a> | |
<div class="expander-section"> | |
This is the contents of section 2 | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment