Allow the carousel 'slide' animation to be disabled.
This commit is contained in:
@@ -5,6 +5,7 @@ import EmblaCarousel, {
|
||||
EmblaPluginType,
|
||||
} from 'embla-carousel';
|
||||
|
||||
import { TransitionEffect } from '../types';
|
||||
import { dispatchFrigateCardEvent } from '../common';
|
||||
|
||||
import carouselStyle from '../scss/carousel.scss';
|
||||
@@ -22,7 +23,7 @@ export class FrigateCardCarousel extends LitElement {
|
||||
* @param index Slide number.
|
||||
*/
|
||||
carouselScrollTo(index: number): void {
|
||||
this._carousel?.scrollTo(index);
|
||||
this._carousel?.scrollTo(index, this._getTransitionEffect() === 'none');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,6 +51,14 @@ export class FrigateCardCarousel extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the transition effect to use.
|
||||
* @returns An TransitionEffect object.
|
||||
*/
|
||||
protected _getTransitionEffect(): TransitionEffect | undefined {
|
||||
return 'slide';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Embla options to use.
|
||||
* @returns An EmblaOptionsType object or undefined for no options.
|
||||
|
||||
Reference in New Issue
Block a user