Add comment.
This commit is contained in:
1 parent
56465e4f92
commit
046313eb47
1 file changed
+5
-2
@@ -105,13 +105,16 @@ export class FrigateCardCarousel extends LitElement {
|
||||
* @param index Slide number.
|
||||
*/
|
||||
public carouselScrollTo(index: number): void {
|
||||
const scroll = () => this._carousel?.scrollTo(index, this.transitionEffect === 'none');
|
||||
const scroll = () =>
|
||||
this._carousel?.scrollTo(index, this.transitionEffect === 'none');
|
||||
// This ensures scrolling can work on initial render when the carousel may
|
||||
// not yet exist.
|
||||
if (this._carousel) {
|
||||
scroll();
|
||||
} else {
|
||||
this.updateComplete.then(() => {
|
||||
scroll();
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user