2952 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 200+ members
  • Has sold $125,000+ on Envato Market
  • Had an item featured in an Envato Bundle
+10 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: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
  • Sells items exclusively on Envato Market
  • Contributed a free file of the month
+8 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
  • Has been part of the Envato Community for over 5 years
  • Has referred 200+ members
  • Has sold $125,000+ on Envato Market
  • Had an item featured in an Envato Bundle
+10 more
DDStudios says

Is it supposed to hide the other tweets?

Nothing happened.

2024 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
  • Sells items exclusively on Envato Market
  • Contributed a free file of the month
+8 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
  • Has been part of the Envato Community for over 5 years
  • Has referred 200+ members
  • Has sold $125,000+ on Envato Market
  • Had an item featured in an Envato Bundle
+10 more
DDStudios says

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

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

Sorry mate.

65 posts
  • Has been part of the Envato Community for over 3 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+4 more
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: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
  • Sells items exclusively on Envato Market
  • Contributed a free file of the month
+8 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

2575 posts Put a Donk On It
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+10 more
ThemeProvince says

Thats one attractive twitter feed ;)

2952 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 200+ members
  • Has sold $125,000+ on Envato Market
  • Had an item featured in an Envato Bundle
+10 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. ;)

2217 posts
  • Has referred 200+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 50+ items on Envato Market
+10 more
crozer says

Just remember that jQuery Cycle is also your friend :D

by
by
by
by
by
by