Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How do you stop AnythingSlider via code? Re: How do you stop AnythingSlider via code?

#78254
oneworld95
Member

This is not the most elegant solution, but it works:

Code:
function stopSlider(){
while (1 == 1){
$(“div.anythingSlider a#start-stop”).trigger(“click”);
if ($(“div.anythingSlider a#start-stop”).html().indexOf(“Go”) != -1)
break;
}
}

Trigger the "click" on the "start-stop" element, checking after each click to see if the html of the element contains the word "Go". If it does, break out of loop. Even though the AnythingSlider code has a line saying "Pass startStop(false) to stop and startStop(true) to play", I couldn’t figure out how to call that function regardless of what I tried. Now this solution works and I’m happy :D