JSFiddle - React, Tailwind, and code Playground

HTML

<div></div>
<div></div>

CSS

div {
    height: 200px;
    background: red;
    margin-bottom: 1em;
}

JavaScript

$.fn.slideUpRemove = function (d, c) {
    var _this = this,
        duration = typeof d === 'number' ? d : 400,
        callback = typeof c === 'function' ? c : d;

    return this.slideUp(duration).promise().done(function () {
        _this.remove();
        if (typeof callback === 'function') callback.call();
    });
};
$('div').delay('500').slideUpRemove(1000, function () {
    console.log($('div').length);
});