Wednesday 29 November 2017

javascript - Animate width to fit-content

I need to animate a div from a
width of 0 (initial) to a width
fit-content (a width that is the same as the width of its
content)



$('div').css('width',
'fit-content');



href="https://jsfiddle.net/yzugzf3h/1/" rel="nofollow
noreferrer">DEMO



However, if I do
this the animation



transition:
width .5s
ease-in-out;


doesn't
work anymore. So the question is how can I animate just to fit the content
?




UPDATE: I found the solution href="https://stackoverflow.com/questions/3508605/how-can-i-transition-height-0-to-height-auto-using-css">here
(DEMO

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...