
[英]How to add left and right arrows to scroll slider without jQuery and bootstrap?
[英]Slider with left/right arrows
您能告诉我如何为离子滑块组件创建向右/向左箭头吗?
演示: Stackblitz
注意:请参阅home.html
页面
.html
<ion-slides [pager]="true" [slidesPerView]="2">
<ion-slide>
<h1>Slide 1</h1>
</ion-slide>
<ion-slide>
<h1>Slide 2</h1>
</ion-slide>
<ion-slide>
<h1>Slide 3</h1>
</ion-slide>
</ion-slides>
您可以创建两个按钮。
<button (click)="this.Slides.slidePrev()" class="backBtn"> <ion-icon name="arrow-back"></ion-icon> </button>
<button (click)="this.Slides.slideNext()" class="nextBtn"> <ion-icon name="arrow-forward"> </ion-icon> </button>
注意:这只是一个pseudo code
(click)="this.Slides.slidePrev()"
然后,您需要将它们放置在CSS上,这样就可以了:)
CSS:
.backBtn{
position: absolute;
left: 20vw;
top: 40vh;
width: 15vw;
height: 15vw;
border-radius: 50%;
border: none;
background: red;
}
.nextBtn{
position: absolute;
right: 20vw;
top: 40vh;
width: 15vw;
height: 15vw;
border-radius: 50%;
border: none;
background: green;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.