Ionic framework 离子滑动溢流

Ionic framework 离子滑动溢流,ionic-framework,ionic4,ion-slides,Ionic Framework,Ionic4,Ion Slides,我正在使用ion幻灯片,在第二张幻灯片上变换图像,放大和缩小后,图像在主幻灯片上溢出 这是我的主幻灯片,第二张幻灯片内容丰富: HTML: 我使用了z-index和overflow-x:hidden,但什么也没发生,我不确定是否需要使用,但是如果你像这样构造模板代码,就让中的默认布局来构造你的内容 html <ion-content> <ion-slides> <ion-slide class="slide-main"> <im

我正在使用ion幻灯片,在第二张幻灯片上变换图像,放大和缩小后,图像在主幻灯片上溢出

这是我的主幻灯片,第二张幻灯片内容丰富:

HTML:


我使用了z-index和overflow-x:hidden,但什么也没发生,我不确定是否需要使用
,但是如果你像这样构造模板代码,就让
中的默认布局来构造你的内容

html

<ion-content>
  <ion-slides>
    <ion-slide class="slide-main">
      <img class="img-main" src="https://cdopromos.com/wp-content/uploads/2019/07/maxs-restaurant-chicken-all-you-can.jpg">
    </ion-slide>
    <ion-slide class="slide-secondary">
      <img class="img-secondary" src="https://images.pexels.com/photos/2397361/pexels-photo-2397361.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=500">
    </ion-slide>
  </ion-slides>
</ion-content>
最终结果看起来是这样的

.row-main{
  height: 100vh;
  width: 100vw;
}

*{
  padding: 0;
}
.img-secondary{
  height: 100vh;
  transform: scale(1);
    animation: zoominout 30s infinite ;

}

.img-main{

}
.row-secondary{
  z-index: -1;
}
.swiper-slide{
  z-index: -1;

}

@keyframes zoominout {
  0% {
      transform: scale(1,1);
  }
  50% {
      transform: scale(1.2,1.2);
  }
  100% {
      transform: scale(1,1);
  }
}

.slide-main{
  z-index: 99;
}
<ion-content>
  <ion-slides>
    <ion-slide class="slide-main">
      <img class="img-main" src="https://cdopromos.com/wp-content/uploads/2019/07/maxs-restaurant-chicken-all-you-can.jpg">
    </ion-slide>
    <ion-slide class="slide-secondary">
      <img class="img-secondary" src="https://images.pexels.com/photos/2397361/pexels-photo-2397361.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=500">
    </ion-slide>
  </ion-slides>
</ion-content>
/**
Add this to your scss
 */
ion-slide {
  overflow-x: hidden!important; // or overflow: hidden or overflow-y: hidden
}
/**
Add this to your scss
 */

.row-main{
  height: 100vh;
  width: 100vw;
}

*{
  padding: 0;
}
.img-secondary{
  height: 100vh;
  transform: scale(1);
  animation: zoominout 30s infinite ;

}

.img-main{

}
.row-secondary{
  z-index: -1;
}
.swiper-slide{
  z-index: -1;

}

@keyframes zoominout {
  0% {
    transform: scale(1,1);
  }
  50% {
    transform: scale(1.2,1.2);
  }
  100% {
    transform: scale(1,1);
  }
}

.slide-main{
  z-index: 99;
}