JSFiddle - React, Tailwind, and code Playground

by kentaromiura

HTML

<div id="test"></div>

CSS

#test{
    width:100px;
    height:100px;
    background-color: lightsteelblue;
}

JavaScript

Fx.Percent = new Class({
    Extends:Fx,
    initialize: function(element, options){
        var self = this;
        self.element = $(element);
        self.setOptions(options);
    },
    set: function(now){
        var self = this,
            property = this.options.property || 'height';
        self.element.setStyle(property, now + '%');        
    }
});

var test = new Fx.Percent('test', {
        property:'opacity'
    });
test.start(1,0);