Skip to content

Commit

Permalink
feat(esl-carousel): add current and related slide element accessors t…
Browse files Browse the repository at this point in the history
…o carousel change event
  • Loading branch information
ala-n committed Jun 27, 2024
1 parent 2313c2a commit 4064b9f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/modules/esl-carousel/core/esl-carousel.events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ export class ESLCarouselSlideEvent extends Event implements ESLCarouselSlideEven
Object.assign(this, init);
}

/** @returns current slide element */
public get $currentSlide(): HTMLElement | null {
return this.target.slideAt(this.current);
}

/** @returns related slide element */
public get $relatedSlide(): HTMLElement | null {
return this.target.slideAt(this.related);
}

public static create(type: 'BEFORE' | 'AFTER', init: ESLCarouselSlideEventInit): ESLCarouselSlideEvent {
return new ESLCarouselSlideEvent(ESLCarouselSlideEvent[type], init);
}
Expand Down

0 comments on commit 4064b9f

Please sign in to comment.