我正在制作一个简单的角度滑块。当前在演示中,我仅显示one
图像,并使用next
和previous
按钮滑动一个图像以显示{{1 }}或上一张图片。
我能否每次显示next
或两张图像,并单击2
或1
按钮仅滑动next
或一张图像?
这是我的代码 https://stackblitz.com/edit/angular-slider-animation-gkcg99?file=src%2Fapp%2Fapp.component.ts
previous
我想在加载时显示两幅图像,并在单击@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
animations: [trigger("move", [
state("forward", style({ transform: 'translateX(0)' })),
state("backward", style({ transform: 'translateX(0)' })),
state("backward-inactive", style({ transform: 'translateX(100%)' })),
state("forward-inactive", style({ transform: 'translateX(-100%)' })),
transition('forward => forward-inactive', [
style({ transform: 'translateX(0)' }),
animate(DUR, style({ transform: 'translateX(-100%)' }))
]),
transition('forward-inactive => forward, backward-inactive => forward', [
style({ transform: 'translateX(100%)' }),
animate(DUR, style({ transform: 'translateX(0)' }))
]),
transition('backward-inactive => backward, forward-inactive => backward', [
style({ transform: 'translateX(-100%)' }),
animate(DUR, style({ transform: 'translateX(0)' }))
]),
transition('backward => backward-inactive, forward => backward-inactive', [
style({ transform: 'translateX(0)' }),
animate(DUR, style({ transform: 'translateX(100%)' }))
]),
transition('backward => forward-inactive', [
style({ transform: 'translateX(0)' }),
animate(DUR, style({ transform: 'translateX(-100%)' }))
])
])]
})
和next
按钮的情况下单击左右滑动一张图像
有任何更新吗?