Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
wait for all jQuery animations to complete then make the newly expanded section can be seen in the viewport
$container = $('myElem');
$(":animated").promise().done( function() {
if( $container[0].getBoundingClientRect().top < 50 ) {
$('html,body').animate({scrollTop: $container.offset().top}, 800);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.