Link to home
Create AccountLog in
Avatar of MJS72
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.
Avatar of MJS72
MJS72

ASKER

I've upped the points in the hope of attracting some help.  I have also attached the HTML and JS file to make it easier for anyone willing to help me out.
index.htm
jquery.tools.min.js
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); 
};

Open in new window

Avatar of MJS72

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
Avatar of MJS72

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.
Avatar of MJS72

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.
Avatar of MJS72

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
ASKER CERTIFIED SOLUTION
Avatar of geck1942
geck1942
Flag of France image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
oops, and move the line 2: "do_Autoplay();" to the bottom of this script
Avatar of MJS72

ASKER

Ahhhh beautiful ..... exactly what I was after :o)

Thank you so much