Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

87
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda