2952 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Bought between 100 and 499 items
  • Contributed a Blog Post
  • Elite Author
  • Exclusive Author
+5 more
DDStudios says

Hey guys, here is what I have :

These tweets are pulled from the twitter api and everything work well, what I want to do, is to make it so I only have 1 visible and then it cycle trough all of the tweets (slide down) and go back to the first one and then continue the cycle.

How would you guys do it?

Thanks!

Dany

2024 posts
  • Elite Author
  • Author had a Free File of the Month
  • Has been a member for 4-5 years
  • Austria
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Envato Studio (Microlancer) Beta Tester
+3 more
revaxarts says
I would do it with an Interval:
var current = 0,
 timebetween = 5000, 
count = $('.tweet_list li').length,
interval = setInterval(function(){

  setCurrentActiveAndHideLast(current);

  (count>=current)?current++:current=0;
},timebetween);
2952 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Bought between 100 and 499 items
  • Contributed a Blog Post
  • Elite Author
  • Exclusive Author
+5 more
DDStudios says

Is it supposed to hide the other tweets?

Nothing happened.

2024 posts
  • Elite Author
  • Author had a Free File of the Month
  • Has been a member for 4-5 years
  • Austria
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Envato Studio (Microlancer) Beta Tester
+3 more
revaxarts says

hehe, you have to make a setCurrentActiveAndHideLast function :D

Here the whole script (untested)


var current = 0, //start at 0 (first)
    last, // define for the last
    timebetween = 5000, //time between
    tweets = $('.tweet_list li'), //jquery object with all tweets
    count = tweets.length, //tweet count

//intervall
interval = setInterval(function(){

    //call action
    setCurrentActiveAndHideLast(current);
    //action is called set the last to the current
    last = current;
    //if current reach the tweetcount start with the first one again
    (count>=current)?current++:current=0;
},timebetween);

//hide all tweetd
tweets.hide();

function setCurrentActiveAndHideLast(current){
    //show the current
    tweets.eq(current).slideDown();
    //and hide the last if set
    if(last != null)tweets.eq(last).slideUp();
}
2952 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Bought between 100 and 499 items
  • Contributed a Blog Post
  • Elite Author
  • Exclusive Author
+5 more
DDStudios says

Nope doesn’t work, probably something I’m doing wrong.

I’m always confused about this kind of stuff ..

Sorry mate.

62 posts
  • Author had a File in an Envato Bundle
  • Bought between 10 and 49 items
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
  • United Kingdom
WebDesignPlanet says

By the way, if there is nothing more than UL inside “tweet” div, you can probably get rid of the latter and apply CSS directly to the UL. Best practice is to avoid “divitis”, i.e. too many empty nested divs. But you probably know this already.

2024 posts
  • Elite Author
  • Author had a Free File of the Month
  • Has been a member for 4-5 years
  • Austria
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Envato Studio (Microlancer) Beta Tester
+3 more
revaxarts says

Nope doesn’t work, probably something I’m doing wrong.

I’m always confused about this kind of stuff ..

Sorry mate.

Ok I fiddled it out. it was a little tricky but now it should work

2566 posts Put a Donk On It
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • United Kingdom
  • Exclusive Author
  • Attended a Community Meetup
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 200 and 499 users
+5 more
ThemeProvince says

Thats one attractive twitter feed ;)

2952 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Bought between 100 and 499 items
  • Contributed a Blog Post
  • Elite Author
  • Exclusive Author
+5 more
DDStudios says


Nope doesn’t work, probably something I’m doing wrong.

I’m always confused about this kind of stuff ..

Sorry mate.
Ok I fiddled it out. it was a little tricky but now it should work

That’s awesome.

Do you have Skype? I would have some stuff to ask you that i’m to embarassed to ask here lol

edit Found you, added you. ;)

2213 posts
  • Football Contest Participant/Runner-up
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Germany
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
  • Author had a File in an Envato Bundle
+5 more
crozer says

Just remember that jQuery Cycle is also your friend :D

by
by
by
by
by
by