Question: I've got the problem with `scrollIntoView()` function.
I've got a tree and two buttons:

1. first of them will scroll tree to bottom node
2. second will scroll tree to top node

I don't know what I should to do that this scroll operation will always scroll node to top of tree. I mean about situation from this fiddle:

<http://jsfiddle.net/presto41/xzb62pw5/8/>

If you will click on button `#button1 (Scroll to bottom node)` then tree will be scroll to the bottom node - but bottom node will not be on the top of tree. It's working as "just show node. Done".

I want that scroll to bottom node will be work as scroll to top node in this scenario:

1. click on `#button1 (Scroll to bottom node)`
2. click on `#button2 (Scroll to top node)`
3. topNode is on the top of tree

Any ideas? I was trying to manipulate this `scrollIntoView()` function by [options](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) but either I was doing something wrong or it can't works as I expect.

---

> 
> Edit: I don't understand why anyone give me minus for that question. I
>  made a research, I was trying to solve that problem by myself and I
>  put clear description of my problem. It's irritating.
> 
> 
> 

---

> 
> Edit 2: I haven't ids of these nodes. I've got just node as
>  Fancytree.FancytreeNode object so I need a solution without operation
>  on the node id.
> 
> 
> 

---

> 
> Edit 3: this is my pseudocode witch is the most similar with original:
>  <http://jsfiddle.net/presto41/xzb62pw5/27/>
> 
> 
>

Answer: 
I found the solution.
The solution is function:

```
function expandAndScrollTo(node) {
       node.setExpanded(true).then(()=>{
       node.span.scrollIntoView({behavior:'smooth', inline:'start'});
  });}

```
Use of scrollIntoView() is for to scroll the element with id="content" into the visible area of the browser window:

```
    var el = document.getElementById("content");
    el.scrollIntoView();

```

however you can use

```
    function scrollToBottom(){
       var eldiv = document.getElementById("content");
       eldiv.scrollTop = div.scrollHeight - div.clientHeight;
    }
    function scrollToTop(){
       var eldiv = document.getElementById("content");
       eldiv.scrollTop = 0;
    }

```