Search code examples
javascriptmeteormeteor-helper

Animating live changes in meteor issue


I am trying to animate each time the post.text is updated in meteor using Percolate:Momentum (I have tried other plugins but those didn't work either). The post.text updates fine, but it does not animate - not sure what I am doing wrong :S

JS

Template.textDisplay.helpers({
  post: function () {
    return MongoDatabase.findOne({}, { sort: { date: -1} });
  }
});

MongoDatabase.insert({
  text: message,
  date: new Date()
});

HTML

<template name="textDisplay">   
{{#momentum plugin='right-to-left'}}

    {{post.text}}

{{/momentum}}   
</template>

Solution

  • @Peter looking at the code it seems like Percolate:Momentum support just multiple elements a collection.find() cursor with at least 2 elements works fine. I made a simple jQuery use of fadeIn() to show you how you can actually use any jQuery to animate it http://meteorpad.com/pad/32rHhkm6NmdxSsTt4/Copy%20of%20Test

    you can try open a github issue for Percolate:Momentum maybe they have a work around or find a different library? But if it's just a single element it's actually easy to use jQuery for this. But there probably should be different animation package that works with just one element. Hopefully this is helpful.