diff --git a/app/components/default-modal.js b/app/components/default-modal.js index e5004c66..34a1da2f 100644 --- a/app/components/default-modal.js +++ b/app/components/default-modal.js @@ -1,23 +1,30 @@ import Component from '@ember/component'; +const TOTAL_SLIDES = 3; + export default Component.extend({ tagName: '', open: true, - slideNumber: 1, - totalSlides: 3, + slideNumber: Math.floor(Math.random() * TOTAL_SLIDES) + 1, // start on a random slide actions: { toggleModal() { this.toggleProperty('open'); }, nextSlide() { - if (this.slideNumber < this.totalSlides) { + if (this.slideNumber < TOTAL_SLIDES) { this.set('slideNumber', this.slideNumber + 1); + } else { + // comment out the line below to disable infinite looping + this.set('slideNumber', 1); } }, prevSlide() { if (this.slideNumber > 1) { this.set('slideNumber', this.slideNumber - 1); + } else { + // comment out the line below to disable infinite looping + this.set('slideNumber', TOTAL_SLIDES); } }, },