I am using jquery to do two things. First, I have an accordion box (created using .slideToggle) that slides down when the user clicks a link. Second, I have a link that the user can click, which will scroll the window down (using .scrollTop) to reveal some content on the bottom of the page.
I would like to combine these two functions so that when the user clicks on a link, the accordion box will slide open and then the scrollbars will scroll down to the bottom of the page.
It is important that this happen in that order. So for example, I don't want the window to scroll down to the bottom of the page and then the accordion box to open because the accordion box effects the overall height of the window.
Here are the two functions:
<script type="text/javascript">
$(document).ready(function(){
$(".btn-slide").click(function(){
$("#panel").slideToggle("slow");
$(this).toggleClass("active");
return false;
});
});
</script>
<script type="text/javascript">$(document).ready(function() {
$("#fireslide").click(function() {
$(document).scrollTop( $("#no").offset().top );
return false;
});
});
</script>
Where #no
sits at the bottom of #panel