I'm having a problem animating the change in width of a div. More precisely, this div ("CSVStatus") changes width to fit the size of the text.I don't control it. But when it happen i would like to make it animate.
As you can see in this jsFiddle, the transition on the color change of the background works but not the transition on the width.
Here is the reproduction of the problem i encounter :
HTML:
<div id="CSVStatus"></div>
<br><br><br>
<div id="CSVBtn" type="button">Click here</div>
CSS:
#CSVStatus{
background-color: #6c757d;
float:left;
height:36px;
padding:5px;
min-height: 25px;
min-width: 25px;
transition: background-color ease-in 1s, width ease-in 1s;
}
#CSVBtn{
background-color:red;
height: 20px;
width: 80px;
padding:15px;
}
JQUERY:
var status = 1;
$(CSVBtn).on("click",function(){
//success
if(status == 1){
$('#CSVStatus').css("background-color","#28a745");
$('#CSVStatus').text("Uploaded");
status++;
}
//warning
else if(status == 2){
$('#CSVStatus').css("background-color","#ffc107");
$('#CSVStatus').text("Uploaded, but no config found");
status = 1;
}
});
So how to make this autoResize animate ?
Thanks for help