最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - TweenLite does not animate - Stack Overflow

programmeradmin5浏览0评论

I am trying to do a simple animation of top-margin using GreenSocks TweenLite for Javascript. I've used the library many times but, for some reason, it's not working this time. Note: The "onComplete" is firing but, no matter what element I use, I cannot animate any CSS properties on HTML elements.

HTML

<div id="GS_PipelineHeadline h2"></div>

JAVASCRIPT

TweenLite.to("#GS_PipelineHeadline h2", 0.5, 
{ 
    "margin-top": 0, 
    ease: "Back.easeOut", 
    onComplete: function () 
    { 
        console.log("Crap"); 
    } 
});

Here is a real quick JSFiddle I created that includes all the CSS, JS and HTML. /

If anyone has any ideas, I would appreciate it!

I am trying to do a simple animation of top-margin using GreenSocks TweenLite for Javascript. I've used the library many times but, for some reason, it's not working this time. Note: The "onComplete" is firing but, no matter what element I use, I cannot animate any CSS properties on HTML elements.

HTML

<div id="GS_PipelineHeadline h2"></div>

JAVASCRIPT

TweenLite.to("#GS_PipelineHeadline h2", 0.5, 
{ 
    "margin-top": 0, 
    ease: "Back.easeOut", 
    onComplete: function () 
    { 
        console.log("Crap"); 
    } 
});

Here is a real quick JSFiddle I created that includes all the CSS, JS and HTML. http://jsfiddle/mBPug/

If anyone has any ideas, I would appreciate it!

Share Improve this question edited Dec 6, 2013 at 3:13 Lee Taylor 7,98416 gold badges37 silver badges53 bronze badges asked Dec 5, 2013 at 22:02 dygfloyddygfloyd 651 silver badge5 bronze badges 2
  • It might help if you made a jsfiddle that demonstrates the issue you are having. – J. Holmes Commented Dec 5, 2013 at 22:09
  • Good call. I just updated my post. – dygfloyd Commented Dec 5, 2013 at 22:17
Add a ment  | 

1 Answer 1

Reset to default 6

A few things:

  • add the CSS plugin to your fiddle
  • "margin-top" wasn't going to do much, use top instead

.

TweenLite.to("#GS_PipelineHeadline", 0.5, {
    top: 0,
    ease: Back.easeOut,
    onComplete: function () {
        console.log("Crap");
    }
});

http://jsfiddle/mBPug/4/

发布评论

评论列表(0)

  1. 暂无评论