Skip to content
This repository was archived by the owner on May 4, 2022. It is now read-only.
This repository was archived by the owner on May 4, 2022. It is now read-only.

ion-slides (Swiper) autoHeight option doesn't adjust the container height to active slide #661

Closed

Description

@ionitron-bot

Original issue by @tru03 on 2018-08-07T11:59:05Z

Ionic version: (check one with "x")
(For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[ ] 3.x
[x] 4.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request

Current behavior:

If you use the ion-slides component with autoHeight option set to true, it doesn't adjust the ion-slides height to the active slide's content height as it supposed to.

Expected behavior:

The container should adjust to the content height of the active slide: http://idangero.us/swiper/demos/390-autoheight.html

Related code:

<ion-slides [options]="{autoHeight: true}">
    <ion-slide>
        <div style="width: 100%; height: 300px; background: red;"></div>
    </ion-slide>
    <ion-slide>
        <div style="width: 100%; height: 300px; background: blue;"></div>
    </ion-slide>
    <ion-slide>3</ion-slide>
</ion-slides>

Other information:

The ion-slide element (and .swiper-slide class) having a height of auto instead of 100% seems to fix the issue.

.swiper-container-autoheight, .swiper-container-autoheight .swiper-slide {
    height: auto;
}

This style definition which should provide the desired effect is not getting through the shadow DOM of this implementation.

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

   ionic (Ionic CLI)          : 4.0.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.1
   @angular-devkit/core       : 0.7.0-rc.3
   @angular-devkit/schematics : 0.7.0-rc.3
   @angular/cli               : 6.0.8
   @ionic/ng-toolkit          : 1.0.0
   @ionic/schematics-angular  : 1.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions