How to animate div height on mouse hover using jQuery

  1825 views   2 years ago jQuery

Use the jQuery animate() method

You can simply use the jQuery animate() method in combination with the mouseenter() and mouseleave() methods to animate the height of a <div> element on mouseover.

Let's try out the following example to understand how it actually works:

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>jQuery Animate Div Height on Hover</title>
        width: 400px;
        height: 150px;
        background: #f0e68c;
        border: 1px solid #a29415;
<script src=""></script>
        var boxHeight = $(".box").height();
                height: "300"
                height: boxHeight
    <p><strong>Note:</strong> Place mouse pointer over the box to play the animation.</p>
    <div class="box"></div>


Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]