diff --git a/src/cards.ts b/src/cards.ts index 110c80ede5..ebe714ee90 100644 --- a/src/cards.ts +++ b/src/cards.ts @@ -173,4 +173,15 @@ export class Cards extends Component implements Openable { } this._removeRevealCloseEventHandlers(); }; + + static Init() { + if (typeof document !== 'undefined') + // Handle initialization of static cards. + document.addEventListener('DOMContentLoaded', () => { + const cards = document.querySelectorAll('.card'); + cards.forEach((el) => { + if (el && (el['M_Card'] == undefined)) this.init((el as HTMLElement)); + }); + }); + } } diff --git a/src/index.ts b/src/index.ts index e8b227939a..4842b11aa8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -138,3 +138,4 @@ Forms.Init(); Chips.Init(); Waves.Init(); Range.Init(); +Cards.Init();