Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Horizontal scroll in ionic 4 as ion-scroll working in ionic 3?

Tags:

angular

ionic4

I am trying ion-scroll in ionic 4 but not working? I get some solution from ionic forum, use div instead of deprecated ion-scroll but it is not working for me. I need to scrollX for card item in a single row.

like image 219
Vikas Kumar Avatar asked Sep 17 '18 08:09

Vikas Kumar


Video Answer


1 Answers

I have created horizontal scrolable gallery for images in ionic 4. It work perfectly fine for me!

.thumnails{
  overflow-x: scroll;
  overflow-y: hidden;
  .list-thumbnail{
    height: 100%;
    white-space: nowrap;
    .img-thumb{
      display: inline-block;
      border: 1px solid #ddd;
      border-radius: 4px;
      padding: 3px;
      width: 50px;
      height: 50px;
      margin:0 2px 0 0; 
      line-height: 60px;
    }
    .selected-img{
      border: 2px solid color($colors, primary);
    }
  }
}
::-webkit-scrollbar { 
  display: none; 
}

<div class="thumnails">
  <div class="list-thumbnail">
    <div class="img-thumb" [class.selected-img]="x.selected" *ngFor="let x of images" (click)="onThumbnailClick(x)">
      <img [src]="x.image">
    </div>
  </div>
</div>
like image 186
Shriniwas b Avatar answered Sep 30 '22 03:09

Shriniwas b