Hey guys,
I’m now having a little problem with adding “new elements” and exeuting a function after it. For example, I have this template.
<div>
{{#each getMessages}}
<div>
<div class="message animated fadeIn {{#if this.own}}me{{/if}}">
<p>{{this.message}}</p>
<div class="image">
<img src="...">
</div>
</div>
<p class="clear"></p>
</div>
{{/each}}
</div>
Okay, my helpers return a reactive-array:
Template.chat.helpers({
'getMessages': function () {
window.setTimeout(function()
{
$("#chatDiv").mCustomScrollbar("scrollTo", "last");
},500);
return userMessages.list();
}
});
As you can see, I execute a 500ms delay to scroll to the bottom of my chat div. Is there any better way without using a mauel time delay?