diff --git a/js/controls.js b/js/controls.js index 64ff9cb..e4f7304 100644 --- a/js/controls.js +++ b/js/controls.js @@ -93,7 +93,7 @@ export class Controls extends HTMLElement { this._controlRef.first.disabled = !prev; this._controlRef.prev.disabled = !prev; this._controlRef.next.disabled = !next; - this._controlRef.last.disabled = !next; + this._controlRef.last.disabled = this._deck.currentIndex === (this._deck.totalSlides - 1); this._controlRef.pos.innerText = `${this._deck.currentIndex + 1} / ${this._deck.totalSlides}`; } } diff --git a/js/navigator.js b/js/navigator.js index d6fb3fe..27a4772 100644 --- a/js/navigator.js +++ b/js/navigator.js @@ -116,6 +116,11 @@ export class Navigator extends HTMLElement { * @returns {boolean} True if a subsequent slide exists */ get hasNext() { + const host = this.querySelector("div"); + const appear = host.querySelectorAll(".appear"); + if (appear && appear.length) { + return true; + } return this._currentIndex < (this.totalSlides - 1); } @@ -160,6 +165,7 @@ export class Navigator extends HTMLElement { */ next() { if (this.checkForAppears()) { + this.dispatchEvent(this.slidesChangedEvent); return; } if (this.hasNext) {