How to play automatically
Closed this issue · 2 comments
Samdyddd commented
How to play automatically
cameronbraid commented
setTimeout(()=>lory.next(), 1000);
or it you want it to stop automatically calling next during touch interaction or mouseover use something like the following :
stopAutoTimer() {
clearInterval(this.timeout)
},
resetAutoTimer() {
this.stopAutoTimer()
this.timeout = setInterval(()=>this.next(), 2000)
},
subscribeTo('on.lory.touchstart', ()=>this.stopAutoTimer());
subscribeTo('on.lory.touchend', ()=>this.resetAutoTimer());
subscribeTo('mouseover', ()=>this.stopAutoTimer());
subscribeTo('mouseout', ()=>this.resetAutoTimer());
this.resetAutoTimer()
Saturate commented
This has been answered, closing it.