I have the following HTML code:
<div class="card-deck" fxLayout.xs="row" style="overflow: scroll; height:100%">
<md-card style="width:10rem" *ngFor="let make of filteredMakes" (click)="goToModels(make.niceName)"
class="page-card mat-card">
<img md-card-image="" src="assets/img/gallery/brands/256/{{make.name}}.png" class="mat-card-image" />
<md-card-subtitle class="mat-card-title text-center">{{ make.name }}</md-card-subtitle>
</md-card>
</div>
This is how it looks like on mobile:
I would like to create an animation that scrolls horizontally automatically to the last manufacturer, but stops when a user interacts with it.
In other words:
Where I am having trouble:
1) Auto Scroll: You can use the JS setInterval function to change every x mS the position of your div.
2) you can use @HostListener annotation ( see Angular doc ) to watch user interaction and cancel setInterval with clearInterval JS function when a click event is fired