Denly
Denly

Reputation: 949

scroll() doesn't work in meteor autorun

scroll() doesn't work when the template appears, but it works once if server restart (by update code) or if I run the code in chrome console.

Template.chatBubble.onRendered(function() {
Tracker.autorun(function () {
 if(Session.get('chatBubble')){
  $('.textArea').scroll(function() {
  console.log('is scrolling');
 }
});});

html

{{#if isChatbubble}}
{{> chatBubble}}
{{/if}

p.s I use scroll to pagination. Thank you so much

Upvotes: 0

Views: 99

Answers (1)

Ethaan
Ethaan

Reputation: 11376

Try with this.

Meteor.setTimeout(function(){
$('.textArea').scroll(function() {
  console.log('is scrolling');
 }
},0);

Upvotes: 1

Related Questions