2952 posts
  • 6 Years of Membership
  • Affiliate Level 5
  • Author Level 8
  • Bundle Boss
+12 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

2280 posts
  • Top Monthly Author
  • Weekly Top Seller
  • Community Superstar
  • Industrious API Inventor
+15 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
  • 6 Years of Membership
  • Affiliate Level 5
  • Author Level 8
  • Bundle Boss
+12 more
DDStudios
says

Is it supposed to hide the other tweets?

Nothing happened.

2280 posts
  • Top Monthly Author
  • Weekly Top Seller
  • Community Superstar
  • Industrious API Inventor
+15 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
  • 6 Years of Membership
  • Affiliate Level 5
  • Author Level 8
  • Bundle Boss
+12 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
  • 4 Years of Membership
  • Affiliate Level 2
  • Author Level 5
  • Beta Tester
+5 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.

2280 posts
  • Top Monthly Author
  • Weekly Top Seller
  • Community Superstar
  • Industrious API Inventor
+15 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

2627 posts Put a Donk On It
  • Weekly Top Seller
  • Elite Author
  • Exclusive Author
  • Featured Author
+11 more
ThemeProvince
says

Thats one attractive twitter feed ;)

2952 posts
  • 6 Years of Membership
  • Affiliate Level 5
  • Author Level 8
  • Bundle Boss
+12 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. ;)

2258 posts Digital Artist
  • Front Page Master
  • Top Monthly Author
  • Trendsetter
  • Weekly Top Seller
+15 more
crozer
says

Just remember that jQuery Cycle is also your friend :D

by
by
by
by
by
by