Question

I'm using the jQuery SlideDown/SlideUp functions to open and close a div. It's working fine, but, because the div that opens is far down on the page, it opens below the fold, and you have to scroll down further to see the content inside of the div.

What I'd like to do is add in some sort of function to the end of the jQuery script, that sends to the bottom of the page once the animation's complete. Even if it's a matter of adding an to the "a.sjc-social" button that sends to . I just need a way to call this at the end of the jQuery script, so it triggers last.

Here's what I currently have:

<script>
$('a.sjc-social').click(function () {
if ($('div.tintup').is(":hidden")) {
$('div.tintup').slideDown("slow");
} else {
$('div.tintup').slideUp("slow");
}
});
</script>

Any help you can offer would be much appreciated!

Thanks.

Was it helpful?

Solution

try this

$('html, body').animate({scrollTop:$(document).height()}, 'slow');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top