Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Auto scroll - a start but not working right #30

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
5 changes: 4 additions & 1 deletion src/app/channels/channels.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export class ChannelsComponent implements OnInit {
}

setChannelSelection(channel: Channel): void {
window.location.hash = channel.anchorIdentifier
window.location.hash = channel.anchorIdentifier;
var element = window.document.getElementById(channel.anchorIdentifier);
let element2 = element.getElementsByClassName('mat-expansion-panel-content')[0];
element2.scrollIntoView({behavior: 'smooth', block: 'start'});
}
setChannelSelectionFromLocation(): void {
const anchor = window.location.hash;
Expand Down
3 changes: 3 additions & 0 deletions src/app/schemas/schemas.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export class SchemasComponent implements OnInit {

setSchemaSelection(schema: Schema): void {
window.location.hash = schema.anchorIdentifier
let element = window.document.getElementById(schema.anchorIdentifier);
let element2 = element.getElementsByClassName('mat-expansion-panel-content')[0];
element2.scrollIntoView({behavior: 'smooth', block: 'start'});
}
setSchemaSelectionFromLocation(): void {
this.selectedSchema = window.location.hash;
Expand Down