I have a slider, it still works very well. But now I still need an autoplay and there is no clue about how to implement it. Anyone's idea?
var current = 1; Var wDoc = $ (document). With (); Var box = $ (".bg-box"); Var Box Length = box.length + 2; Var clipLL = $ ('.clip' ul); Var speed animation = 1000; Function Slidebox (from) {If (from & lt; 0) {clipUl.css ('left', - ((box-2) * wDoc); = Box Lang - 3; } And if (from> (box length - 1)) {clipUl.css ('left', - (1 * wDoc)); = 2; } ClipUl.stop (). Chetan ({left: - (* wDoc)}, speedAnimation; current = to; currentNum = current; $ ('Pagging box.') RemoveClass ('active'). If (from> (length of box - 2)) {CurrentNum = 1;} (from == 0) {currentNum = boxLength - 2;} $ ('# Pagg' + currentNum) .addClass ('active');};
Try this:
var startAutoPlay = function () {Var time = 2000; / / (2 second); current = 0; SetInterval (function () {slidebox (current); current + = 1;}, time);} StartAutoPlay ();
Comments
Post a Comment