Click here to Skip to main content
15,891,789 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Asp.net web application
I have one div (div is scrollable), inside this div there is a treeview.
I want to scroll selected treeview node into middle of div.

By using selectednode.scrollintoview(true), I am able to scroll selected node on top of div.
but my requirement is to scroll/show that node in middle of div.

Solutions tried :

1) div.scrolltop = (div.scrollheight - div.clientheight) * 0.5
this line of code, scrolls the div's scrollbar into middle, but i want to scroll selected node into middle.

2) I am doing this jQuery(myDiv).scrollTo(selectednode); this is also not working.


Kindly help me out ASAP.
I am struggling with this since 3-4 days.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900