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

@susanlinsfu Thanks for opening an issue with us! Would you mind making a plunker or codepen that we can use to reproduce your issue? Here is a template you can use to make your plunker: http://plnkr.co/edit/L8JN6w5mqwbMY2E14dbk?p=preview

jgw96 avatar Apr 25 '16 14:04 jgw96

Hi,

I have created a punker: http://plnkr.co/edit/G0LbU4SL9uVFgj6zCJYE?p=preview . Essentially there is a slide. This slide has a list with many items. This list is a large list so the user must be able to scroll down to view all of them, but scrolling is not possible.

I have tried to add style="overflow-y:scroll" to the slide and the scrolling is enabled,but if you look you will notice items are being cutoff so the entire list is not displayed.

Cheers

susanlinsfu avatar Apr 25 '16 16:04 susanlinsfu

@brandyscarney Sorry to ask, but I was wondering if there has been any progress on this?

susanlinsfu avatar May 06 '16 19:05 susanlinsfu

Hey @susanlinsfu, unfortunately I haven't looked into fixing this in the framework yet, but you should be be able to override the height of the ion-slides element in order to fix it for your specific use case:

ion-slides {
  height: auto;
}

Let me know if this doesn't work!

brandyscarney avatar May 06 '16 21:05 brandyscarney

@brandyscarney it does allow scrolling and all the elements fit, but the height becomes as big as the biggest slide for all the slides. This means if slide one has more elements than slide 2, then slide 2 once it scrolls to the last element it will be able to keep scrolling through blank white space.

susanlinsfu avatar May 11 '16 03:05 susanlinsfu

Try .slide-zoom{ height:100%; }

Elfwines avatar May 11 '16 17:05 Elfwines

@Elfwines Hi, I have tried it and it didn't do anything.

susanlinsfu avatar May 13 '16 03:05 susanlinsfu

@susanlinsfu : Look here http://plnkr.co/edit/SjYtZYdBCIph5ipyyrn6?p=preview . I meant in addition to the overflow-y, sorry.

Elfwines avatar May 13 '16 07:05 Elfwines

@Elfwines AHHHHHh my apologizes, yes this works exactly how I want it to work! Thanks so much for the punkr!

susanlinsfu avatar May 15 '16 00:05 susanlinsfu

Fix worked for me to. Will this be part of the future releases? Or maybe it is already?

reisenmachtfreude avatar Aug 11 '16 18:08 reisenmachtfreude

So none of this worked for me. I ended up having to wrap my content in ion-scroll tags and add the following to my sass so that the bottom would scroll above the pagination dots.

ion-scroll
  height: 100%
  .scroll:after
    content: " "
    display: block
    height: rem(100)

samcdavid avatar Aug 23 '16 12:08 samcdavid

humm.. get the same bug here and those solution does not work. I'm a newbie in app and not have been able to create a working plunker... any other thing to try ?? https://plnkr.co/edit/9BMTxpdUUIB4NMZiUXin?p=preview

NitrofMtl avatar Oct 08 '16 15:10 NitrofMtl

work around !!! I just add a <ion-content> tag and it is working fine.

<ion-view view-title="programs"> <ion-content padding="true" >
<ion-slides options="options" slider="data.slider"> <ion-slide-page ng-repeat="alarm in alarms"> <ion-content> <div class="list">`

NitrofMtl avatar Oct 09 '16 19:10 NitrofMtl

Try

ion-slide{
      ion-list{
          height: 100vh;
          overflow-y: scroll;
      }
}

reneszabo avatar Oct 22 '16 21:10 reneszabo

I can confirm that adding a <ion-content scroll="true"> inside the will allow scrolling vertically the view.

The content, however, will overlap the page indicators of the slider: I'm not exactly sure how to solve it, but a possible approach is to use calc (css3) on the ion-content's height to reduce the height of the content, so that it will not overlap the indicators, but it will not work on every single device.

Alternatively, you may want to style the indicator to have a solid background color.

briosheje avatar Oct 25 '16 09:10 briosheje

I have a slider that slide "vertically". one of the page contains a list of cards which needs to be scrolled vertically also. can we do that is it there any fix for this issue

<ion-slides  options="{'loop': false,direction: 'vertical'}" slider="data.sliderDelegate" delegate-handle="slider1"  >
<ion-slide-page id="" style="background:transparent;" class="slider-content slider-padding-custome">
<p> first Page</p>
</ion-slide-page>
<ion-slide-page>
<ion-list id="home-list3">
      <ion-item class="item-divider" id="home-list-item-divider2"> Yesterday</ion-item>
      <div class="item item-body"  style="display: table; width: 100%; border-width: 0; border-bottom-color: #e3e3e3; border-bottom-width: 2px;">
        <div style="display: table-cell; vertical-align: middle; margin-right: 20px; height: 50px !important; width: 10%">
          <i class="icon ion-ios-shuffle" style="font-size: 30px;"></i>
        </div>
        <div style="display: table-cell; vertical-align: middle; margin-right: 20px; height: 50px !important;  padding-left: 10px">
          <p  style="font-weight:400; font-size: 15px; margin: 0; color: black;">PAYMENT SADAD</p>
          <p  style="font-weight:300; font-size: 15px; margin: 0; color: #A9A9A9;">Zain - Postpaid</p>
        </div>
        <div style="display: table-cell; vertical-align: middle;  margin-right: 20px; height: 50px !important; text-align: right;">
          <p  style="font-weight:400; font-size: 18px; margin: 0; color: #008578;">USD1,500.00</p>
        </div>
      </div>
</ion-slide-page>```

khaledwj90 avatar Mar 01 '17 14:03 khaledwj90

I have solved this with this simple css:

ion-slides { height: initial; }

jalbertos avatar Mar 11 '17 14:03 jalbertos

@jalbertos this is not working for me. non of items are showing in the page after this "CSS"

what i need to do is letting the user slide down then customer can scroll over transaction (Scroll down and up) and when he reach to the end he can slide again to the top.

Example: Snapchat when the user slide down he will see the list of images and he can scroll over them and when he scroll to the top and reach to end and keep scrolling the page will slide up again to the camera.

khaledwj90 avatar Mar 12 '17 08:03 khaledwj90

focus from fifth input field onward does not scroll elements wrt added bottom padding

<ion-content>
    <ion-slides>
    <ion-slide>
        <ion-list>
      <ion-item>
        <ion-label floating>item1</ion-label>
        <ion-input type="text"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label floating>item2</ion-label>
        <ion-input type="text"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label floating>item3</ion-label>
        <ion-input type="text"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label floating>item4</ion-label>
        <ion-input type="text"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label floating>item5</ion-label>
        <ion-input type="text"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label floating>item6</ion-label>
        <ion-input type="text"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label floating>item7</ion-label>
        <ion-input type="text"></ion-input>
      </ion-item>
      <ion-item>
        <ion-label floating>item8</ion-label>
        <ion-input type="text"></ion-input>
      </ion-item>      
    </ion-list>
    </ion-slide>
  </ion-slides>
</ion-content>

kevendra avatar Apr 30 '17 14:04 kevendra

As @brandyscarney said setting the height in CSS solves the issue for one slider. But when you move to the next slide which may be smaller than the first one there is empty space at bottom of the content as height is applied for the entire slider.

prantikv avatar Feb 21 '18 04:02 prantikv