I make a slider in jquery using animate
function and margin-left
.
please check my jquery code https://jsfiddle.net/uvsb6asa/10/
function addToMarginLeft(elem, pixels) {
var ml = parseFloat(elem.css('margin-left'));
elem.animate({
'margin-left': (ml + pixels) + 'px'
},1000)
}
I want to make same functionality in angular 4 . I am able to add fade in and fade out animation on button click . but how I will set margin-left or sliding effect from left to right
in button click
here is my code
https://stackblitz.com/edit/angular-slider-animation-ztr63u?file=src/app/app.component.ts
animations: [trigger("fade", [
state("void", style({ opacity: 0 })),
transition("void <=> *", [animate("0.5s ease-in-out")])
])]
})