ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

ionic2 - vertical scrolling inside of a slide

Open susanlinsfu opened this issue 10 years ago • 30 comments

I have a couple of slides which have dynamic content that is added to them. The problem is the content inside of the slides doesn't scroll. So if I have a lot of items only some show and there is no ability to slide. How can I make it so the content in my lists slides inside of their slides?

<ion-content>
    <ion-slides (change)="onSlideChanged($event)">
        <ion-slide >
            <ion-list>
            <ion-item *ngFor="#item of items1; #i = index">
            <h2>{{item}</h2>
            </ion-item>
            </ion-list>
        </ion-slide>
         <ion-slide>
                 <ion-list>
            <ion-item *ngFor="#item of items2; #i = index">
            <h2>{{item}</h2>
            </ion-item>
            </ion-list>
        </ion-slide>
    </ion-slides>
</ion-content>

susanlinsfu avatar Apr 25 '16 00:04 susanlinsfu

Here is my css temporary fix (it's very hacky and I hate it):

ion-slide {
    .slide-zoom {
        height: calc(100vh - 143px);
        overflow-y: auto;
    }
}

The 143px comes from the the addition of 60px for top header, 41px for bottom tabs, plus a 16px vertical padding on my ion-content

pistou avatar Mar 14 '18 11:03 pistou

That solution works perfectly until you want an at the bottom end, then it doesn't get triggered... Anyone with this same problem and a working solution?

guillermogfer avatar May 02 '18 15:05 guillermogfer

I ended up with

.html

<ion-slides>
<ion-slide>
  <ion-content>
    <ion-infinite-scroll (ionInfinite)="doInfiniteFetchProducts($event)" *ngIf="...">
      <ion-infinite-scroll-content></ion-infinite-scroll-content>
    </ion-infinite-scroll>
  </ion-content>
</ion-slide>
<ion-slide>
  <ion-content>
    <...>
 </ion-content>
</ion-slide>
</ion-slides>

.scss

ion-slide {
.slide-zoom {
  height: 100%;
  ion-content {
    .scroll-content {
      margin-bottom: 0px !important;
    }
  }
}

}

guillermogfer avatar May 02 '18 16:05 guillermogfer

ion-slide{
    overflow: auto;
}

.slide-zoom {
    text-align: center;
    position: absolute;
    top: 0;
    display: block;
    width: 100%;
    height: auto;
    padding: 50px 10px;
}

rhrahul avatar Jun 03 '18 19:06 rhrahul

Nothing worked for me

sameerj1985 avatar Jun 11 '18 21:06 sameerj1985

this worked for me on slides with different heights

.swiper-slide {
   display: block;
}
ion-slide{ 
  ion-list{
      height: 90vh; // padding for footer
      overflow-y: scroll;
  }
}

bulbul-ismail avatar Jun 16 '18 10:06 bulbul-ismail

.swiper-slide{ overflow-y: scroll; display: block; }

ion-slide{ height: auto; }

Worked for slides of variable lengths.

prateekkembhavi avatar Jun 20 '18 13:06 prateekkembhavi

Now, ion-refresher is not working properly. It gets refreshed every time I scroll to down even if there are more items in the list.

vishavjeetnokhwal avatar Jul 15 '18 04:07 vishavjeetnokhwal

Thanks for the issue! We have moved the source code and issues for Ionic 3 into a separate repository. I am moving this issue to the repository for Ionic 3. Please track this issue over there.

Thank you for using Ionic!

ionitron-bot[bot] avatar Nov 01 '18 19:11 ionitron-bot[bot]

Issue moved to: https://github.com/ionic-team/ionic-v3/issues/43

ionitron-bot[bot] avatar Nov 01 '18 19:11 ionitron-bot[bot]