Callback to .delay()

前端 未结 3 1611
-上瘾入骨i
-上瘾入骨i 2020-12-05 23:43

I have an $image that I .fadeIn and .fadeOut, and then .remove after .fadeOut completes. This is my code:

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-06 00:06

    You can always do it as:

    $image
        .fadeIn()
        .fadeOut(function() {
            var self = this; // Not sure if setTimeout
                             // saves the pointer to this
            setTimeout(function() {
                $(self).remove();
            }, 1000)
        });
    

提交回复
热议问题