Skip to content

Commit

Permalink
feat(esl-carousel): add ability to pass slide as a goTo parametr
Browse files Browse the repository at this point in the history
  • Loading branch information
ala-n committed Jun 27, 2024
1 parent 8162b43 commit 2313c2a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/esl-carousel/core/esl-carousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ export class ESLCarousel extends ESLBaseElement {
}

/** Goes to the target according to passed params */
public goTo(target: ESLCarouselSlideTarget, params: ESLCarouselActionParams = {}): Promise<void> {
public goTo(target: HTMLElement | ESLCarouselSlideTarget, params: ESLCarouselActionParams = {}): Promise<void> {
if (target instanceof HTMLElement) return this.goTo(this.indexOf(target), params);
if (!this.renderer) return Promise.reject();
const {index, dir} = toIndex(target, this.state);
const direction = params.direction || dir || 'next';
Expand Down

0 comments on commit 2313c2a

Please sign in to comment.