timelinejs
timelinejs copied to clipboard
Loop ?
Any way to made a loop so after the last item the timeline go to the first one?
/* 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(); },