MJS72
asked on
JQuery Tools Scrollable Tabs Autoplay
I have been experimenting with the demo from the flowplayer.org site (http://flowplayer.org/tools/demos/scrollable/demo-area.html).
I have created my own www.picadillo.co.uk/demo and would like it to autoplay the tabs until a user clicks on one of them.
I have read a few forum posts on their website, but have absolutely no background in Javascript at all. The JS file does have a line that says autoplay - false. But I have changed this and it still doesn't work.
Please help.
I have created my own www.picadillo.co.uk/demo and would like it to autoplay the tabs until a user clicks on one of them.
I have read a few forum posts on their website, but have absolutely no background in Javascript at all. The JS file does have a line that says autoplay - false. But I have changed this and it still doesn't work.
Please help.
you can try this
var autoplay = null;
$("#scroll").scrollable().onSeek = function() {
clearTimeout(autoplay); //cancel the previous autoplay timer
autoplay = setTimeout(function(){ //prepare a call in 1000ms to show the next tab.
var tabCount = $("#scroll").scrollable().getItems().length;
var currentTab = $("#scroll").scrollable().getIndex();
if(currentTab == tabCount -1) //if it's the last tab....
{
$("#scroll").scrollable().seekTo(0); // ...show the first one
}
else
{
$("#scroll").scrollable().nextPage(); // ...or show the next one
}
},1000);
};
ASKER
You are going to think I am really thick. But where do I put it :o)
Before the end of the </script> tag. Near the end of your page
ASKER
No joy I am afraid. I have uploaded it again so you can check also.
Oh ok, i misunderstood your problem, I made it autoplay WHEN user click on a tab.
ASKER
I've just noticed that it is doing the reverse of what I need it to.
It only autoplays after someone has clicked on one of the tabs. What I need is for it to autoplay when the page loads and then stop autoplaying when the user clicks on one of the tabs.
Hope that makes sense.
It only autoplays after someone has clicked on one of the tabs. What I need is for it to autoplay when the page loads and then stop autoplaying when the user clicks on one of the tabs.
Hope that makes sense.
ASKER
I should have refreshed my screen before posting my last message .... looks like you know what I need now anyway.
I really appreciate your time with this.
Many thanks
I really appreciate your time with this.
Many thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oops, and move the line 2: "do_Autoplay();" to the bottom of this script
ASKER
Ahhhh beautiful ..... exactly what I was after :o)
Thank you so much
Thank you so much
ASKER
index.htm
jquery.tools.min.js