All you need to do is increase the time for each value:

$(document).ready(function(){
     var words = ['one', 'two', 'three', 'four', 'five'];
     $.each(words,function(index,val){
         setTimeout(function(){
             $('#tweet').slideUp(function(){
                $(this).text( val ).slideDown();
             });
         },index*2000);
    });
});

<div id=tweet></div>

Also check your syntax, a = {1,2,3} is invalid, the {} braces are for
initialising objects with keys and values.

cheers,
- ricardo

On Jan 24, 10:38 am, realin <real...@gmail.com> wrote:
> Hi Guys,
>
> Is there a way to loop through an array while i insert the elements
> into a div and animate it. THe scenario is like i want a slide show of
> text inside a div. So the div with id "tweet" gets update with array
> elements after 5 secs.
>
> This is waht i come up with, i know it may be a total mess, but i am
> the new one here ..
>
> a={0,1,3,4,5};
> $(document).ready(function(){
>        jQuery.each(a,function(){
>              $("#tweet").text(this.text);
>             setTimeout('$("#tweet").slideUp("slow")',2000);
>         });
>     });
>
> <div id=tweet></div>
>
> Thanks in advance :)
>
> Cheers !!
> Realin!

Reply via email to