JSFiddle - React, Tailwind, and code Playground
by joplomacedo
HTML
<div class="myClass" id="0"></div>
<div class="myClass" id="1"></div>
<div id="log"></div>
CSS
.myClass {
width: 500px;
height: 50px;
background: red;
}
#log {
position: fixed;
bottom: 0;
width: 100%;
height: 50px;
background: black;
color: white;
}
JavaScript
var widths = {},
key;
$(".myClass").each(function() {
widths[$(this).attr("id")] = $(this).width();
$(this).animate({ width: '10px' });
});
for (key in widths) {
$('#log').append('id="' + key + '" width: ' + widths[key] + "px <br/>");
}