How do you fadeIn and animate at the same time?

前端 未结 3 579
没有蜡笔的小新
没有蜡笔的小新 2020-12-01 02:44

Using jQuery I\'m creating a basic \'tooltip\' animation so that the tooltip will appear in a little animation in which it fades into view as well as move vertically.

<
3条回答
  •  日久生厌
    2020-12-01 03:19

    For people still looking a couple of years later, things have changed a bit. You can now use the queue for .fadeIn() as well so that it will work like this:

    $('.tooltip').fadeIn({queue: false, duration: 'slow'});
    $('.tooltip').animate({ top: "-10px" }, 'slow');
    

    This has the benefit of working on display: none elements so you don't need the extra two lines of code.

提交回复
热议问题