Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

86
Views
scrollbar should move bottom when searched text matched inside div matched text content which is having scrollbar

I am sharing the example code which is showing a search bar and scrollbar for a div, but searched text should navigate to matched place and scrollbar also should move to bottom when the text is in last line or middle or inside any place.

https://stackblitz.com/edit/angular-textarea-highlight-f5jvj3?file=src%2Fapp%2Ftextarea-highlight%2Ftextarea-highlight.component.ts

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can solve it (I implemented at least the scollTop-position) the following way:

ngAfterContentChecked(): void {
  if (this.$backdrop) {
    this.handleScroll();
  }
}
handleScroll() {
  const markElem = this.$backdrop.nativeElement.querySelector('mark');
  if (markElem) {
    this.$backdrop.nativeElement.scrollTop = markElem.offsetTop;
    this.$textarea.nativeElement.scrollTop = markElem.offsetTop;
  }
}

Check this StackBlitz with the changes to your code:

https://stackblitz.com/edit/angular-textarea-highlight-7lvdsn?file=src/app/textarea-highlight/textarea-highlight.component.ts

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!