Return to Snippet

Revision: 17519
at September 8, 2009 09:47 by jamesming


Initial Code
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Loop through an array using jQuery</title>
    <script src="http://code.jquery.com/jquery-latest.js"    
    type="text/javascript"></script>
    <script type="text/javascript">
        var arrNames = ['Tom', 'Jane', 'Harry', 'Rick', 'Moby'];

        $.each(arrNames, function(i, val) {
            setTimeout(function() {
                $('#divDisp').fadeOut("slow", function() {
                    $(this).text(val).fadeIn("slow");
                });
            }, i * 3000);
        });
    </script>
</head>
<body>
<div id='divDisp'></div>
</body>
</html>

Initial URL
http://www.devcurry.com/2009/09/loop-and-animate-elements-of-array.html

Initial Description

                                

Initial Title
Loop and Animate Elements of an Array using jQuery

Initial Tags
array, jquery

Initial Language
jQuery