diff --git a/src/swiper-element.mjs b/src/swiper-element.mjs index 387d03187..a87333e94 100644 --- a/src/swiper-element.mjs +++ b/src/swiper-element.mjs @@ -40,8 +40,6 @@ const addStyle = (shadowRoot, styles) => { class SwiperContainer extends ClassToExtend { constructor() { super(); - - this.attachShadow({ mode: 'open' }); } static get nextButtonSvg() { @@ -149,6 +147,9 @@ class SwiperContainer extends ClassToExtend { initialize() { if (this.swiper && this.swiper.initialized) return; + + this.attachShadow({ mode: 'open' }); + const { params: swiperParams, passedParams } = getParams(this); this.swiperParams = swiperParams; this.passedParams = passedParams;