timelinejs icon indicating copy to clipboard operation
timelinejs copied to clipboard

Loop ?

Open judzk opened this issue 6 years ago • 1 comments

Any way to made a loop so after the last item the timeline go to the first one?

judzk avatar Mar 29 '18 06:03 judzk

/* Just change these two functions accordingly and include loopAround: true in the options ;) */

get_next: function () { var self = this; var result = self.get_current() + 1; if(self.options.loopAround && self.get_current() >= self.get_count() -1){ result = 0; } return result; },

change_slide: function (type, itemIndex) { var self = this; if(!type) type='load'; if (type === 'click'){ self.options.startItem = itemIndex; self.autoplay_init(); }else { if (self.get_count() - 1 > self.get_current() && self.initials.direction === 0){ self.options.startItem = self.get_next(); }else if(self.get_current() > 0 && self.initials.direction === 0) { self.options.startItem = self.get_next(); self.change_timeline(); }else { self.autoplay_clear(); } } self.change_timeline(); },

rewrite123 avatar May 24 '19 20:05 rewrite123