Animate min width - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:animate

Description

Animate min width

Demo Code

ResultView the demo in separate window



<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $(".btn1").click(function(){
        $("#p1").animate({minWidth: "200px"});
    });//from   ww  w  .j  a v  a 2s .c  om
    $(".btn2").click(function(){
        $("#p1").animate({minWidth: "100px"});
    });
});
</script>
</head>
<body>

<button class="btn1">Animate</button>
<button class="btn2">Reset</button>

<div>This is a paragraph.</div>
<p id="p1" style="width:100px;border:1px solid blue;">This is an animated paragraph.</p>
<div>This is a paragraph.</div>

</body>
</html>

Related Tutorials