I have created a basic animation feature where users can click on an expanding box. I am looking for a solution that does not involve using a plugin.
Currently, the code looks like this:
$('#one').css("height", "22");
$('#t1').click(function() {
if ($('#one').hasClass("extended")) {
$('#one').stop(true, true).animate({height: '22px'},500);
$('#one').removeClass("extended");
$('#a1').stop(true, true).animate({opacity: '1'},500);
} else {
$('#one').animate({height: '120px'},500);
$('#one').addClass("extended");
$('#a1').animate({opacity: '0'},300);
}
});
The issue I'm facing is with overflowing text inside the div. How can I adjust the height of the box to accommodate the text? I hope this explanation makes sense!
Here is the HTML structure:
<div class="rightBox">
<div id="one" style="overflow:hidden;">
<h3><a href="#" id="t1">Availability</a></h3><p id="a1"><a href="#" title="Slide Down"><img src="<?php echo home_url(); ?>/img/arrow.png" alt="Arrow" /></a></p>
<?php include 'availability.php'; ?>
</div>
</div><!-- END.#rightBox -->