How to use Animated Selector Method in JQuery

This article describe about Animated Selector Method in JQuery.
  • 1641

Use :Animated Selector method in jQuery

Animated method is use to select all the elements for current animated.

Select any element that is currently animated.

Example

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        function aniDiv() {

            $("div:eq(0)").animate({ width: "10%" }, "slow");

            $("div:eq(0)").animate({ width: "30%" }, "slow", aniDiv);

        }

        aniDiv();

        $(".btn1").click(function () {

            $(":animated").css("background-color", "yellow");

        });

    });

</script>

</head>

<body>

<button class="btn1">Change color</button>

<div style="background:red;">Row 1</div>

<div style="background:green;">Row 2</div>

<div style="background:blue;">Row 3</div>

</body>

</html>

Output

op1.jpg

After click this Button

op2.jpg


You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2019 DotNetHeaven. All rights reserved.