2011-04-24 11:46:45 +12:00

304 lines
8.9 KiB
HTML
Executable File

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jLayout Examples</title>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8" />
<script type="text/javascript" src="../../lib/jquery-1.4.2.js"></script>
<script type="text/javascript" src="../../lib/jquery.metadata.js"></script>
<script type="text/javascript" src="../jsizes/jquery.sizes.js"></script>
<script type="text/javascript" src="jlayout.border.js"></script>
<script type="text/javascript" src="jlayout.grid.js"></script>
<script type="text/javascript" src="jlayout.flexgrid.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($)
{
$('.grid').layout();
$('.flex-grid').layout();
$('.column').layout();
$('.border').layout();
$('.mpb').layout();
// we call the inner layout first
$('.nested-center').layout();
// then we set the outer one to a fixed size, and turn resizing off
$('.nested').width(600).height(400).layout({resize: false});
// we can also specify everything in code; in this example
// we create two columns of equal size.
$('.code').layout({
type: 'grid',
items: [
$('.col-1').width(400),
$('.col-2').width(400)
],
vgap: 3,
hgap: 3
});
$('#flow-left').layout();
$('.horizontal').layout();
$('.vertical').layout();
});
</script>
<style>
.grid, .flex-grid, .column, .border, .mpb, .nested-center, .nested, .code, .horizontal, .vertical {
overflow: auto;
}
.c {
background-color: rgb(220,220,220);
border: 1px solid rgb(200,200,200);
text-align: center;
width: 100px;
height: 100px;
display: inline-block;
}
.e {
height: 150px;
}
.d {
width: 150px;
}
.nested-center, .mpb {
display: inline-block;
}
.mpb .center {
margin-left: 5em;
width: 5em;
height: 5em;
}
.mpb .east {
border-right: 2em solid green;
width: 10em;
}
.mpb .north {
padding-top: 2em;
height: 2em;
width: 35em;
}
.col-1, .col-2 {
padding-right: 2em;
text-align: justify;
display: inline-block;
}
#flow-left {
overflow: auto;
width: 350px;
height: 200px;
}
#flow-left div {
width: auto;
height: auto;
}
.large {
font-size: 3.5em;
}
.small {
font-size: 2em;
}
.medium {
font-size: 3em;
}
</style>
</head>
<body>
<h1><a href="http://www.bramstein.com/projects/jlayout/">jLayout project homepage</a></h1>
<a name="simple-grid"></a>
<h1>2x2 grid</h1>
<div class="grid {layout: {type: 'grid', hgap: 3, vgap: 3, columns: 2, rows: 2}}">
<div class="c">
One
</div>
<div class="c">
Two
</div>
<div class="c">
Three
</div>
<div class="c">
Four
</div>
</div>
<h1>3x2 flex-grid</h1>
<div class="flex-grid {layout: {type: 'flexGrid', hgap: 3, vgap: 3, columns: 3, rows: 2}}">
<div class="c">
One
</div>
<div class="c d">
Two
</div>
<div class="c">
Three
</div>
<div class="c">
Four
</div>
<div class="c d">
Five
</div>
<div class="c">
Six
</div>
</div>
<a name="columns"></a>
<h1>Automatic columns</h1>
<div class="column {layout: {type: 'grid', hgap: 3, vgap: 3}}">
<div class="c">
One
</div>
<div class="c">
Two
</div>
</div>
<a name="border"></a>
<h1>Border</h1>
<div class="border {layout: {type: 'border', hgap: 3, vgap: 3}}">
<div class="c center">
Center
</div>
<div class="c east">
East
</div>
<div class="c west">
West
</div>
<div class="c north">
North
</div>
<div class="c south">
South
</div>
</div>
<a name="mpb"></a>
<h1>Margin, Padding &amp; Border</h1>
<div class="mpb {layout: {type: 'border', hgap: 3, vgap: 3}}">
<div class="c center">
Center + Margin-Left
</div>
<div class="c north">
North + Padding-Top
</div>
<div class="c east">
East + Border-Right
</div>
</div>
<a name="nested"></a>
<h1>Nested layouts</h1>
<div class="nested {layout: {type: 'border', hgap: 3, vgap: 3}}">
<div class="center nested-center {layout: {type: 'grid', hgap: 3, vgap: 3, columns: 2, rows: 2}}">
<div class="c">
One
</div>
<div class="c">
Two
</div>
<div class="c">
Three
</div>
<div class="c">
Four
</div>
</div>
<div class="c east">
East
</div>
<div class="c west">
West
</div>
<div class="c north">
North
</div>
<div class="c south">
South
</div>
</div>
<a name="code"></a><h1>Programmatic grid (columns)</h1>
<div class="code">
<div class="col-1">
<h2>Column 1</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque neque erat, fringilla id, pretium imperdiet, sagittis et, urna. In hac habitasse platea dictumst. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam consequat ullamcorper nulla. Nunc felis lacus, mollis in, mattis a, aliquam at, mi. Quisque laoreet vehicula felis. Nullam purus nulla, accumsan ut, tincidunt vitae, dapibus ac, ante. Proin at pede eget sem ullamcorper porta. Sed quis mauris. Vivamus interdum. Ut eu dolor vel nisi auctor tincidunt. Fusce adipiscing mollis augue. Cras a nunc a elit dictum tincidunt. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aliquam molestie, leo nec faucibus egestas, est sapien varius velit, vitae posuere enim mi et arcu. Sed facilisis est at urna.</p>
<p>Mauris at dolor. Nulla ultricies congue enim. Ut laoreet, ipsum id rutrum mattis, odio sem iaculis neque, eu gravida diam nulla ut nibh. Etiam cursus elementum libero. Suspendisse quis tellus id sapien elementum elementum. Mauris luctus orci eu lorem. Vivamus eu metus. Donec rhoncus porttitor massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean id tellus sed mauris lacinia hendrerit. Quisque ultrices. Donec a dui eget orci malesuada imperdiet.</p>
</div>
<div class="col-2">
<h2>Column 2</h2>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla eget dui. Sed at sem. Vestibulum pharetra suscipit sapien. Aliquam tortor lacus, consequat a, consectetuer quis, adipiscing sit amet, quam. Pellentesque id elit ut dolor iaculis tincidunt. Mauris pharetra, quam vitae pharetra viverra, metus nisi convallis diam, cursus rhoncus eros felis a enim. Duis aliquam molestie urna. In commodo cursus risus. Praesent sem nisi, commodo quis, egestas vel, auctor congue, magna. Nulla facilisi. Quisque facilisis, mauris sit amet semper sollicitudin, pede elit ultricies nunc, ac condimentum odio sapien id sem. In hac habitasse platea dictumst. Praesent rhoncus, neque eu dictum tristique, felis est aliquam est, in lobortis arcu justo non diam. Integer ligula pede, adipiscing at, mattis sit amet, aliquam vel, justo. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
<p>Duis urna. Donec porta, nisl vel egestas euismod, lorem ipsum suscipit ligula, nec venenatis leo lorem non dolor. Sed fringilla mauris at elit. Suspendisse potenti. Proin magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur vel arcu. Donec dapibus mi vitae metus. Ut vestibulum nunc id nisi. Nunc convallis, tellus at fringilla pulvinar, lacus dui gravida risus, id sollicitudin nibh urna sit amet purus.</p>
</div>
</div>
<h1>Flow layout (left)</h1>
<div id="flow-left" class="{layout: {type: 'flow', resize: false, alignment: 'left'}}">
<div class="c small">
One
</div>
<div class="c medium">
Two
</div>
<div class="c medium">
Three
</div>
<div class="c large">
Four
</div>
<div class="c small">
Five
</div>
</div>
<h1>Horizontal layout</h1>
<div class="horizontal {layout: {type: 'flexGrid', rows: 1, hgap: 5, vgap: 5}}">
<div class="c">
One
</div>
<div class="c d">
Two
</div>
<div class="c">
Three
</div>
</div>
<h1>Vertical layout</h1>
<div class="vertical {layout: {type: 'flexGrid', columns: 1, hgap: 5, vgap: 5}}">
<div class="c">
One
</div>
<div class="c e">
Two
</div>
<div class="c">
Three
</div>
</div>
<a href="http://www.bramstein.com/projects/jlayout/">Back to the jLayout project homepage</a>
</body>
</html>