Last active
September 24, 2015 19:02
-
-
Save hpainter/05a3adb7a9b5d8c648e1 to your computer and use it in GitHub Desktop.
expanding sections
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"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
<style type="text/css"> | |
/* add your css here */ | |
</style> | |
</head> | |
<body> | |
<div class="expandable-panel" id="cp-1"> | |
<div class="expandable-panel-heading"> | |
<h2>Content heading 1</h2> | |
</div> | |
<div class="expandable-panel-content"> | |
<p>Panel HTML...</p> | |
</div> | |
</div> | |
<div class="expandable-panel" id="cp-2"> | |
<div class="expandable-panel-heading"> | |
<h2>Content heading 2</h2> | |
</div> | |
<div class="expandable-panel-content"> | |
<p>Panel HTML...</p> | |
</div> | |
</div> | |
<div class="expandable-panel" id="cp-3"> | |
<div class="expandable-panel-heading"> | |
<h2>Content heading 3</h2> | |
</div> | |
<div class="expandable-panel-content"> | |
<p>Panel HTML...</p> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
(function($) { | |
$(document).ready(function () { | |
$('.expandable-panel-heading').on('click',function(evt){ | |
$(this).closest('.expandable-panel') | |
.find('.expandable-panel-content') | |
.slideToggle(); | |
}) | |
}); | |
})(jQuery); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment