'Add Margin to buttons while translating in angular

I have this custom slider

https://stackblitz.com/edit/angular-ivy-airvm5?file=src/app/app.component.css

On Next and Previous buttons clicks images are getting changes from images array but main issue is when we click on next button while translating the next and previous button position are changed to top, but here i want when i translate as different slides will have different height of images so next and previous button should automatically positioned according to the height of images. I was trying to give margin top also

 let currentMargin = parseInt(this.nextdiv.nativeElement.style.marginTop);
 if(isNaN(currentMargin)){
    currentMargin = 0;
  }
   
 let newMargin = currentMargin + 70;  
 this.next.nativeElement.style.marginTop = newMargin+'px';

screenshot:

enter image description here Any solution Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source