How do you fadeIn and animate at the same time?

前端 未结 3 577
没有蜡笔的小新
没有蜡笔的小新 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:24

    $('.tooltip').animate({ opacity: 1, top: "-10px" }, 'slow');
    

    However, this doesn't appear to work on display: none elements (as fadeIn does). So, you might need to put this beforehand:

    $('.tooltip').css('display', 'block');
    $('.tooltip').animate({ opacity: 0 }, 0);
    

提交回复
热议问题