<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"> $(document).ready(function(){ var arrNames = ['Tom', 'Jane', 'Harry', 'Rick', 'Moby','Tom', 'Jane', 'Harry', 'Rick', 'Moby','Tom', 'Jane', 'Harry', 'Rick', 'Moby','Tom', 'Jane', 'Harry', 'Rick', 'Moby','Tom', 'Jane', 'Harry', 'Rick', 'Moby','Tom', 'Jane', 'Harry', 'Rick', 'Moby','Tom', 'Jane', 'Harry', 'Rick', 'Moby']; $.each(arrNames, function(i, val) { setTimeout(function() { $('#divDisp').animate({width:'0px'}, function() { $(this).text(val).animate({width:'350px'}); }); },i * 3000); }); }); </script> </head> <body> <div id="divDisp" style="background-color:#00ff00;"></div> </body> </html>
Thursday, December 13, 2012
Jquery Animate from DataBase
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment