I have a demo here
I'm capturing the scrollLeft
of one element as it's scrolled.
Is it possible to update the second div with the scrollLeft
number so both div scroll left and right together?
The elements have to be separate but I need them to scroll together.
Or is there a simpler way to do this in Angular.
I had this working outside of Angular with jQuery but I don't want to use jQuery in Angular.
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
name = 'Angular 5';
isNavbarCollapsed = true;
private scrollLeft: number
//private scrolLTwo: HTMLElement =
onScroll(event: Event) {
this.scrollLeft = (event.target as HTMLElement).scrollLeft;
//console.log(this.scrollLeft);
this.updateScroll();
}
updateScroll(){
//Update second scrolling element
}
}