Yes, this is my code to auto adapta the cant of element to view fo screen.
@HostListener('window:resize', ['$event'])
onResize(event) {
this.disp()
}
ngOnInit() {
this.disp()
}
async disp() {
let value = 0
if (this.plt.width() >= 668) {
let por = await Number(this.plt.width()) - (Number(this.plt.width()) * 0.2)
value = await por * 0.01068 // this is my % de px * width screen. if device is iphone 6 show 4 item, you can play whit this values
} else {
value = await Number(this.plt.width()) * 0.01068
}
this.slideOpts = {
slidesPerView: value,
freeMode: true,
coverflowEffect: {
rotate: 50,
stretch: 0,
depth: 100,
modifier: 1,
slideShadows: true,
}
}
}