Wednesday 16 December 2020

Jump to any position inside the div

 You could do it like this:

<button (click)="scroll(target)"></button>
<div #target>Your target</div>

and then in your component:

scroll(el: HTMLElement) {
    el.scrollIntoView();
}

or

<div id="editContent">
gfjsdgfjs<br/>
zvncvznbv
</div>
In component side
var elmnt = document.getElementById("editContent");
      elmnt.scrollIntoView();

No comments:

Post a Comment

Baisic Useful Git Commands

  Pushing a fresh repository Create a fresh repository(Any cloud repository). Open terminal (for mac ) and command (windows) and type the be...