JSFiddle - React, Tailwind, and code Playground

by eddiemonge

HTML

<span id="count">123</span>

JavaScript

$.fn.rollingWithDaHomies = function() {
    var ri = $('<div />'),
        ro,
        _self = this;

    _self
        .css({
            overflow: 'hidden',
            height: _self.height(),
            display: 'inline-block'
        })
        .wrapInner('<div />');
    
    ro = _self.find('div');
        
    ri
        .text(parseInt(_self.text(), 10) + 1)
        .appendTo( _self );

    ro.slideUp(1000, function() {
        $(this).remove();
        _self.html( ri.text() );
        ri.remove();
    });
};

function rollMe () {
    setTimeout(function() {
        $('#count').rollingWithDaHomies();
        rollMe();
    }, 2000);
}
rollMe();