jQuery layout plug-in - create layout dynamically

1.4k Views Asked by At

I'm using jQuery UI Layout Plug-in (http://layout.jquery-dev.net/). I need to load a layout on a modal window depending on certain parameters. So on-event I do something like:

$('<div id="container"><div class="ui-layout-west"> <div class="left-panel"><div class="fuelux">Somthing here</div> </div> </div> <div class="ui-layout-center">Something else here </div></div>').layout();

I have no idea why it does not build the layout. Does the plug-in support something like that?..

Help is appreciated.

1

There are 1 best solutions below

9
On BEST ANSWER

You'll need to add your HTML to the DOM first, then initialize the layout. In the example below, I'm adding the container to the body, but you could add it to any element in the DOM:

$('<div id="container"><div class="ui-layout-west"> <div class="left-panel"><div class="fuelux">Somthing here</div> </div> </div> <div class="ui-layout-center">Something else here </div></div>').appendTo('body').layout();

Working Demo