most recent messages now descending - no scroll

var d = $('.msg-container');
d.scrollTop(d.prop("scrollHeight"));

this code works, but cant get it to work with firebase events