Skip to content

Commit

Permalink
fix: Fixing the scroll on generate breakage after adding mat-side-nav…
Browse files Browse the repository at this point in the history
… for drawer
  • Loading branch information
Guney Saramali committed Nov 14, 2024
1 parent b030ac5 commit d950633
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/components/main/main.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ export class MainComponent implements OnInit, OnDestroy {
setTimeout(() => {
let resultsHeight = document.querySelector<HTMLElement>(".results")?.offsetHeight;
let generateButtonPosition = document.querySelector<HTMLElement>("#generate")?.offsetTop;
window.scrollTo(0, (generateButtonPosition ? generateButtonPosition : 0) - (resultsHeight ? resultsHeight : 0) / 5);
let content = document.querySelector<HTMLElement>("mat-drawer-content");
content?.scrollTo(0, (generateButtonPosition ? generateButtonPosition : 0) - (resultsHeight ? resultsHeight : 0) / 5);
}, 200);
}
}
Expand Down

0 comments on commit d950633

Please sign in to comment.