簡體   English   中英

使離子卡適合離子滑動器中的子圖像

[英]Fit ion-card to child image in ionic swiper

我在 Ionic 應用程序中使用 swiperJs 框架。 在這個組件中,使用滑動圖像,我需要離子卡正好適合圖像寬度。

<ion-card>
  <swiper class="horizontal-swiper" [config]="imageSwiperConfig">
    <ng-template swiperSlide *ngFor="let image of images">
      <img class="full-screen-image" src="./assets/{{image}}">
    </ng-template>
  </swiper>
</ion-card>


ion-card {
  border-radius: 2%;
  margin: auto;
  height: 100%;
}

.horizontal-swiper {
  height: 100%;
}

.full-screen-image {
  height: 100%;
  width: auto;
}

public imageSwiperConfig: SwiperOptions = {
  slidesPerView: 'auto',
  preloadImages: true,
  pagination: true,


在此處輸入圖像描述

嘗試將 class .full-screen-image更改為如下所示

.full-screen-image {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM