Skip to content

Commit e25d1c6

Browse files
author
Matthew Doyle
committedDec 2, 2015
Merge pull request #1 from envato/add-auto-height
Add dynamic auto height for content
2 parents 7c9aa9e + e8a6db2 commit e25d1c6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed
 

‎index.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ <h2>Accordion Group <br><small>(single open)</small></h2>
2626
<section data-accordion>
2727
<button data-control>Accordion 1</button>
2828
<div data-content>
29-
<article>Item</article>
29+
<article>
30+
<textarea></textarea>
31+
</article>
3032
<article data-accordion>
3133
<button data-control>2nd Level</button>
3234
<div data-content>
@@ -227,7 +229,7 @@ <h2>Defaults</h2>
227229
&copy; 2014 Victor Fernández / <a href="http://vctrfrnndz.com/">@vctrfrnndz</a> / <a href="mailto:victor@vctrfrnndz.com">email</a> / <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=victor%2emin%2ejs%40gmail%2ecom&lc=US&item_name=jQuery%20Accordion%20Plugin&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest" >donate</a>
228230
</section>
229231

230-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
232+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
231233
<script type="text/javascript" src="js/jquery.accordion.js"></script>
232234
<script type="text/javascript">
233235
$(document).ready(function() {

‎js/jquery.accordion.js

+5
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@
192192

193193
requestAnimFrame(function() {
194194
$content.css('max-height', $content.data('oHeight'));
195+
196+
// Reset max height and set height to auto to allow dynamic
197+
// content sizing until the next accordion interaction
198+
$content.css('height', 'auto');
199+
$content.css('max-height', 'none');
195200
});
196201

197202
$accordion.addClass('open');

0 commit comments

Comments
 (0)
Please sign in to comment.