Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jstree: constraint width

Tags:

html

css

jstree

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?

like image 867
Max Avatar asked Jul 30 '10 08:07

Max


2 Answers

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;
}
like image 178
Ivan Avatar answered Nov 06 '22 19:11

Ivan


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

like image 32
Lorenzo Manucci Avatar answered Nov 06 '22 18:11

Lorenzo Manucci