2017-08-24 90 views
0

我想制作离子幻灯片,显示图像,但我只能显示一个图像,其他图像在左侧,当我尝试看到它时,我只能看到一半或如果我按下按钮我得到的空白 enter image description here问题与离子幻灯片

enter image description here

<ion-slides pager="true"> 
    <ion-slide background-size *ngFor="let item of Offer" [ngStyle]="{'background-image': 'url(' + item.PICPATH + ')'}"> 

    </ion-slide> 
    </ion-slides> 

回答

0

使用CSS,你可以做

.bg{ 
height:100%; 
width:100%; 
background-size: cover; 
background-repeat: no-repeat; 
background-position: 50% 50%; 
} 

,并在你的HTML

<ion-slides pager="true"> 
    <ion-slide> 
    <div class="bg" *ngFor="let item of Offer" [ngStyle]="{'background-image': 'url(' + item.PICPATH + ')'}></div> 
    </ion-slide> 
    </ion-slides> 

这将确保图像被恰当地融入ion-slide

+0

这并不能工作,工作时,应用程序direcation是LTR和我的应用程序direcation是RTL但这并工作方向:LTR重要;对不起,我忘记了我的应用程序的方向 – Nouf