I have 2 components. The first one has a scrollbar, the second one has an *ngFor in which inside there is an accordion. Each accordion has a scrollbar. What I need is to scroll the first container and then scroll the first accordion till the last accordion. Basically the first div has a lot of images and the accordions are the categories. So I should be able to scroll the div with all images and see that the images in the relative accordions scrolls as well. This is what I've done so far. It works partially. The first accordion is correct. But the seconds starts not from the beggining, but from the end. It should be at 0 again and then scroll down.
scrollBoth(element: ElementRef) {
const scrollDiv = element.nativeElement.children[0] as HTMLElement;
this.imagesContainer.forEach(element => {
const scrollImagesPanel = element.nativeElement as HTMLElement;
scrollImagesPanel.scrollTop = scrollDiv .scrollTop;
});
}