Javascript 如何设置左键单击时的边距?
我使用Javascript 如何设置左键单击时的边距?,javascript,angular,Javascript,Angular,我使用animate函数和marginleft在jquery中制作了一个滑块 请检查我的jquery代码 我想在angular 4中实现相同的功能。我能够添加淡入淡出动画按钮点击。但我将如何在按钮单击中设置左边距或从左向右的滑动效果 这是我的密码 动画:[触发(“淡入淡出”[ 状态(“void”,样式({opacity:0})), 过渡(“无效*”,[animate(“0.5s缓进-缓出”)]) ])] }) 您可以尝试使用“变换”而不是“不透明度” 我认为这段代码类似于jquery的效果
animate
函数和marginleft
在jquery中制作了一个滑块
请检查我的jquery代码
我想在angular 4中实现相同的功能。我能够添加淡入淡出动画按钮点击。但我将如何在按钮单击中设置左边距或从左向右的滑动效果
这是我的密码
动画:[触发(“淡入淡出”[
状态(“void”,样式({opacity:0})),
过渡(“无效*”,[animate(“0.5s缓进-缓出”)])
])]
})
您可以尝试使用“变换”而不是“不透明度”
我认为这段代码类似于jquery的效果
animations: [trigger("move", [
transition(':enter', [
animate(500, style({ transform: 'translateX(-100%)' }))
]),
transition(':leave', [
animate(500, style({ transform: 'translateX(-100%)' }))
])
])]
当用户按下previous按钮时,它看起来不正常
next
按钮单击look good按钮查看jquery
url和previous按钮functionality@naveen然后你需要操纵动画状态(请看)@llia你能看看这个吗
animations: [trigger("fade", [
state("void", style({ opacity: 0 })),
transition("void <=> *", [animate("0.5s ease-in-out")])
])]
})
animations: [trigger("move", [
state("void", style({ transform: 'translateX(-100%)' })),
transition("void => *", [animate("0.5s ease-in-out")])
])]
animations: [trigger("move", [
transition(':enter', [
animate(500, style({ transform: 'translateX(-100%)' }))
]),
transition(':leave', [
animate(500, style({ transform: 'translateX(-100%)' }))
])
])]