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.
jQueryScripting LanguagesJavaScript

Avatar of undefined
Last Comment
MJS72

8/22/2022 - Mon
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
geck1942

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

MJS72

ASKER
You are going to think I am really thick.  But where do I put it :o)
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
geck1942

Before the end of the </script> tag. Near the end of your page
MJS72

ASKER
No joy I am afraid.  I have uploaded it again so you can check also.
geck1942

Oh ok, i misunderstood your problem, I made it autoplay WHEN user click on a tab.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
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.
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
geck1942

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
geck1942

oops, and move the line 2: "do_Autoplay();" to the bottom of this script
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
MJS72

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

Thank you so much