I have a modal box with a defined height. Inside of this box there is an accordion box that expands when a user clicks a link. The height of the accordion box when it is toggled exceeds the height of the modal box and thus a scrollbar appears.
I would like to automatically scroll the bars down to its lowest point to display the new content in the accordion box.
The accordian box looks like this:
<script type="text/javascript">
$(document).ready(function(){
$(".btn-slide").click(function(){
$("#panel").slideToggle("slow");
$(this).toggleClass("active"); return false;
});
});
</script>
Is there a way to integrate this scroll down function into the existing function? Is there an existing Jquery function for this type of behavior?
If you don’t want to rely on any plugin, or change the actual URL, you could use scrollTop, see http://api.jquery.com/scrollTop/
Cheers.