I have a div like this: <div id="btn-category-group" style="height:420px;"> .... </div>…
Jump to turn (6)
- User
I have a div like this:
I will use jquery to change the css height:fit-content. So, the height of div will extend to appropiate height based on the content of div. I will it will extend with animation effect.
- Assistant
Here's how you can use jQuery to change the height of the div with animation:
javascript$("#btn-category-group").animate({height: "fit-content"}, 1000);Explanation:
$("#btn-category-group")selects the div with the id "btn-category-group".animate()is a jQuery function that animates CSS properties{height: "fit-content"}specifies the CSS property to animate (height) and the new value that it should have (fit-content)1000specifies the duration of the animation in milliseconds (in this case, 1 second)