I researched online a lot and I could not find anyway to make ion-slides has auto height based on the content image height. If I don’t set the height for the slider, the slide basically won’t work.
This is really inconvenient because we have different devices like iPhone 4, 5 and 6. The image height is set proportional with the width but how can I set the height of the slider to be the same with the image height? Please help.
@HarshadD sorry, but that part of the architecture was changing on Ionic’s side so often. It seemed that as soon as I wrote a solution, they changed their implementation.
Hi, I solve the problem, so just want to comment some things in case it helps for people in the future.
I’m using ionic 3, my slides are inside a component, so a did the autoHeight inside an ngOnInit, but you can do it on the ionViewDidLoad.
ngOnInit() {
this.slides.autoHeight = true;
}
And in the scss, you gotta:
ion-slides {
height: auto;
}
An Important thing for this to work that all the slides have you have some content, if one is empty it will get the height of the other and wont work.
At least it was like these in my case. Hope it helps