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

Vikas Kumar picture Vikas Kumar · Sep 17, 2018 · Viewed 9.8k times · Source

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.

Answer

Shriniwas b picture Shriniwas b · Sep 17, 2018

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>