Max
Max

Reputation: 355

jstree: constraint width

I have a jstree with several subtrees on a page and would like to display something upon selection of a branch. The displayed text should appear next to the tree, but for some reason, jstree is taking up all the space in the div, so the text div is placed underneath. The tree and div should both positioned relative to the encapsulating div and float left.

Is there any way to constrict the tree's width (setting style="width=100px" on the tree div doesn't work)? Or another way to place the text right next to the tree without having it to place absolute?

Upvotes: 6

Views: 6092

Answers (3)

Ivan
Ivan

Reputation: 15932

You have to create a DIV that wraps your jstree-DIV, something like that:

<div id="wrap">
  <div id="jstree">
    // Here you have your tree 
  </div>
</div>

Now set wrapper CSS overflow property to auto and set maximum size:

#wrap {
    width: 200px;
    height: 400px;
    overflow: auto;
}

Upvotes: 2

Lorenzo Manucci
Lorenzo Manucci

Reputation: 880

use max-width. E.g. max-width:100px; set maximum width to 100px.

Upvotes: 1

Max
Max

Reputation: 355

Well, it seems that I have to live with this problem and change my layout.

Upvotes: -1

Related Questions