pratRockss
pratRockss

Reputation: 457

Autoscroll the page to selected component in Angular

My application has tree view in left side of page. when any node is selected in the tree, the information about the page displays in the detail side of the page which is the right side.

Now I have search component at top of page, in which I can search for specific node in tree. When the result is found, the result node is selected.

But the the result node is not in the current view, I want the tree component to be scrolled down to the selected node. Any help on how this can be done would be really helpful.

Upvotes: 0

Views: 89

Answers (2)

Vamsi
Vamsi

Reputation: 388

I think we can directly use, the builtin scrollIntoView function to autoscroll here

Upvotes: 1

Naseer
Naseer

Reputation: 194

You can achieve this by using scrollTo function of jquery.

$('body').scrollTo('#target');

You can also find helpful alternatives in this post scroll element

Upvotes: 0

Related Questions