Wrapping Flow layout not setting containers Height.

96 views
Skip to first unread message

Darren

unread,
May 19, 2011, 5:25:52 PM5/19/11
to jLayout
Hi, I'm trying to get the container to size its height correctly when
a contained "flow layout" wraps to the next line. The container
appears to adjust its height to the height of the first row and not
the contained content as a whole. However I am struggling to
understand the behaviour of the flow layout and therefore I guess that
I'm doing something wrong! Below is a same HTML that just isn't
working for me:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Flow Layout</title>
<style type="text/css">
#flow { border: 2px solid green; padding: 5px; width:
800px; }
#flow div { border: 2px solid blue; width: 200px; height:
20px; }
</style>
<script type="text/javascript" src="jquery-1.6.1.min.js" ></
script>
<script type="text/javascript" src="jquery.sizes.js"></script>
<script type="text/javascript" src="jlayout.flow.js"></script>
<script type="text/javascript" src="jquery.jlayout.js"></script>
<script type="text/javascript">
jQuery(function ($) {
$('#flow').layout({ type: 'flow', vgap: 2, hgap: 2,
resize: true });
});
</script>
</head>
<body>
<div id="flow">
<div>Hello 1</div>
<div>Hello 2</div>
<div>Hello 3</div>
<div>Hello 4</div>
<div>Hello 5</div>
<div>Hello 6</div>
</div>
</body>
</html>

Any advise would be really appreciated.
Darren

Bram Stein

unread,
Jun 2, 2011, 6:02:51 PM6/2/11
to jla...@googlegroups.com
Hi,

Sorry for the late response---I totally forgot about your mail until
now. Did you have a look at the simple examples? There is a flow
layout example whose container height is adjusted properly. As far as
I can tell, the only difference is the resize property. Could you try
setting it to false?

Bram

> --
> You received this message because you are subscribed to the Google Groups "jLayout" group.
> To post to this group, send email to jla...@googlegroups.com.
> To unsubscribe from this group, send email to jlayout+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jlayout?hl=en.
>
>

Darren

unread,
Jun 5, 2011, 10:37:49 AM6/5/11
to jLayout
Bram, thanks for your reply I have not seen any example that resizes
the container to the size of the content. The number of contained
child entries will be dynamic and therefore I cannot set the height to
be a fixed size, is there anyway that this could be dynamic? Or do
you have another example that I have not seen?

Darren

Bram Stein

unread,
Jun 7, 2011, 4:04:41 AM6/7/11
to jla...@googlegroups.com
Hi Darren,

Flowlayout tries to layout everything in one "flow". If you set it to
automatically resize your container it will align all elements in a
single row. I think the best solution for your use-case is to give a
fixed width, and a very high height. Then do your layout and reset the
height.

Bram

Reply all
Reply to author
Forward
0 new messages