ThemeForest

Need help with Jquery stuff

2942 posts
  • Has been a member for 3-4 years
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Blog Post
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 100 and 499 items
  • Australia
  • Referred between 200 and 499 users
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

1 year ago
1213 posts
  • Has been a member for 2-3 years
  • Community Superstar
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 50 and 99 items
  • Austria
  • Referred between 200 and 499 users
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);
1 year ago
2942 posts
  • Has been a member for 3-4 years
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Blog Post
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 100 and 499 items
  • Australia
  • Referred between 200 and 499 users
DDStudios says

Is it supposed to hide the other tweets?

Nothing happened.

1 year ago
1213 posts
  • Has been a member for 2-3 years
  • Community Superstar
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 50 and 99 items
  • Austria
  • Referred between 200 and 499 users
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();
}
1 year ago
2942 posts
  • Has been a member for 3-4 years
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Blog Post
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 100 and 499 items
  • Australia
  • Referred between 200 and 499 users
DDStudios says

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

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

Sorry mate.

1 year ago
27 posts
  • Has been a member for 1-2 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 1 and 9 items
  • United Kingdom
  • Referred between 10 and 49 users
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.

1 year ago
1213 posts
  • Has been a member for 2-3 years
  • Community Superstar
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 50 and 99 items
  • Austria
  • Referred between 200 and 499 users
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

1 year ago
2389 posts Put a Donk On It
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Interviewed on the Envato Notes blog
  • Beta Tester
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 10 and 49 items
  • United Kingdom
  • Referred between 50 and 99 users
ThemeProvince says

Thats one attractive twitter feed ;)

1 year ago
2942 posts
  • Has been a member for 3-4 years
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Blog Post
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 100 and 499 items
  • Australia
  • Referred between 200 and 499 users
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. ;)

1 year ago
1963 posts
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a File in an Envato Bundle
  • Interviewed on the Envato Notes blog
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Peru
  • Referred between 200 and 499 users
crozer says

Just remember that jQuery Cycle is also your friend :D

1 year ago
by
by
by
by
by