Javascript 将Greensock与Meteor模板一起使用

Javascript 将Greensock与Meteor模板一起使用,javascript,twitter-bootstrap,meteor,tween,gsap,Javascript,Twitter Bootstrap,Meteor,Tween,Gsap,我正在尝试用TweenLite在Meteor模板中设置一个div的动画-我已经安装了gsop包 我的模板html: <template name="mainInit"> <div id="teaContainer"> <h1>Tea</h1> </div> </template> 我没有收到任何错误,但是转换没有发生,它会捕捉到最终位置。此外,它似乎移动了模板中的所有内容,而不是特定的目标。如果我在计时器触发之前记

我正在尝试用TweenLite在Meteor模板中设置一个div的动画-我已经安装了gsop包

我的模板html:

<template name="mainInit">
<div id="teaContainer">
    <h1>Tea</h1>
</div>
</template>
我没有收到任何错误,但是转换没有发生,它会捕捉到最终位置。此外,它似乎移动了模板中的所有内容,而不是特定的目标。如果我在计时器触发之前记录div的宽度,它将返回null,否则如果我在timed函数中记录,它将返回正确的像素宽度

我完全迷路了,有什么想法吗

谢谢

更新:我还尝试在呈现模板后延迟函数。这修复了空问题,但并不能阻止tween影响产量中的所有内容

Template.mainInit.rendered = function() {
            console.log($("#teaContainer").width());
            TweenLite.to($("#teaContainer"), 1, {css:{"margin":"25% auto auto auto"}, ease:Linear.none});
        }

如果将teaContainer设置为模板,则可以将tween连接到template.teaContainer.rendered

没有


我刚试过,它对我有效。我正在使用0.9.3版本中的InfinitiedG:gsap Meteor软件包,答案来自Greenock论坛:


我很想完全理解您的解决方案,如果您不介意,请在代码中分享您的解决方案。
#teaContainer {
    display: block;
    width: 30%;
    height: 30%;
    margin: 65% auto auto auto;
    color: white;
    border: 1px blue solid;
}

#teaContainer h1 {
    padding: 5% 5% 5% 5%;
    text-align: center;
    font-size: 7em;
    color: black;
    border: 1px #000 solid;
}
Template.mainInit.rendered = function() {
            console.log($("#teaContainer").width());
            TweenLite.to($("#teaContainer"), 1, {css:{"margin":"25% auto auto auto"}, ease:Linear.none});
        }