masonry
has a layoutComplete
event that fires when all layout and transitions have completed. As far as I know it does not return a promise, so $.when will probably not be very useful :
$(".image").on('click', function(){
$('.image').not(this).removeClass('big');
$( this ).toggleClass('big');
$container.masonry( 'on', 'layoutComplete', function() {
$('html, body').animate({
scrollTop: $('.big').offset().top
}, 500)
});
$container.masonry()
});