
[html]
<html>
<head>
<title>Fluid grid</title>
<script type="text/javascript" src="script/jquery-1.3.2.min.js"></script>
</head>
<body>
<div class="box"><p><span>01</span>This is box number 1...</p></div>
<div class="box alt"><p><span>02</span>This is box number 2...</p></div>
<div class="box"><p><span>03</span>This is box number 3...</p></div>
<div class="box alt"><p><span>04</span>This is box number 4...</p></div>
<div class="box"><p><span>05</span>This is box number 5...</p></div>
<div class="box alt"><p><span>06</span>This is box number 6...</p></div>
<div class="box"><p><span>07</span>This is box number 7...</p></div>
<div class="box alt"><p><span>08</span>This is box number 8...</p></div>
<div class="box"><p><span>09</span>This is box number 9...</p></div>
</body>
</html>
[/html]
The divs will be our items, articles, Female Cialis trusted pharmacy reviews, Where to buy Female Cialis, posts, or whatever you call it, canada, mexico, india. Buy generic Female Cialis, For better understanding of the layout, it is recommended to replace the sample text 'This is box number...' with a longer one, where can i buy cheapest Female Cialis online. Buy Female Cialis ONLINE WITHOUT prescription, Preferably varies in length between one box to another. BUY Female Cialis ONLINE WITHOUT PRESCRIPTION, The illustration images in this tutorial will be using randomly generated text for the box content.
[html]
<link rel="stylesheet" type="text/css" href="style/reset.css" />
<style type="text/css">
body {
position: relative;
width: 100%;
}
.box {
background-color: #F0F0F0;
color: #888;
font-family: Arial, where can i find Female Cialis online, Female Cialis from canadian pharmacy, Tahoma, serif;
font-size: 13px;
}
.box p {
padding: 10px;
}
.box span {
float: left;
font-size: 26px;
font-weight: bold;
}
div.alt {
background-color: #CCC;
}
</style>
[/html]
At this point, Female Cialis price, coupon, Buy Female Cialis ONLINE WITHOUT prescription, the page will look like this:
[caption id="attachment_2571" align="aligncenter" width="500" caption="With no jQuery"]
[/caption]
[html]
<script type="text/javascript">
var myFluidGrid = {
COLNUMBER : 2, // Minimum column number, order Female Cialis online overnight delivery no prescription. Comprar en línea Female Cialis, comprar Female Cialis baratos, COLMARGIN : 10, // Margin (in pixel) between columns/boxes, buy Female Cialis no prescription.
COLWIDTH : 240 // Fixed width of all columns, BUY Female Cialis ONLINE WITHOUT PRESCRIPTION. Online buy Female Cialis without a prescription, };
</script>
[/html]
$('.box').css('position', purchase Female Cialis online, Order Female Cialis from mexican pharmacy, 'absolute').css('width', this.COLWIDTH + 'px');
$('.box').each(function() {
var tempLeft = (pointer * (self.COLWIDTH + self.COLMARGIN));
$(this).css('left', canada, mexico, india, Order Female Cialis from United States pharmacy, tempLeft + 'px');
var tempTop = 0;
if (arr[pointer]) { tempTop = arr[pointer]; }
$(this).css('top', tempTop + 'px');
arr[pointer] = tempTop + $(this).outerHeight() + self.COLMARGIN;
pointer++;
if (pointer === columns) { pointer = 0; }
});
}
[/js]
What we do here is basically we grab all boxes and set their width value with the default setting (COLWIDTH), order Female Cialis online c.o.d. Buy generic Female Cialis, Then we do an iteration to process each boxes.
Inside the loop, Female Cialis for sale, Japan, craiglist, ebay, overseas, paypal, we calculate the new left and top position for each box. Defining the left position is easy using the pointer variable, Female Cialis gel, ointment, cream, pill, spray, continuous-release, extended-release. BUY Female Cialis ONLINE WITHOUT PRESCRIPTION, Pointer is our current column position. Where to buy Female Cialis, Just multiply pointer with the box's width (plus margin). Don't forget to increase pointer at the end of each iteration (or reset it when it reaches the maximum column number), where can i buy Female Cialis online. Buy Female Cialis from canada, Setting the top position is the tricky one. That's where arr variable comes in handy, fast shipping Female Cialis. It basically stores the bottom position of the last box put on each column, BUY Female Cialis ONLINE WITHOUT PRESCRIPTION. Australia, uk, us, usa, For example: if we put box 1 in column 1 with left=0 and top=0, and box 1 has 80px height, Female Cialis trusted pharmacy reviews. Female Cialis samples, Then arr[0] will be 80 + box margin. This arr[0] is then used as a top position for the box under box 1. See illustration below for details:
[caption id="attachment_2572" align="aligncenter" width="500" caption="Calculating positions"]
[/caption]
At this point the value of arr will be [0]=>(80 + box margin), [1]=>(69 + margin), [2]=>(81 + margin). BUY Female Cialis ONLINE WITHOUT PRESCRIPTION, The next box (box 4) will use arr[0] as its top position. And it goes on until the very last box.
Finally, we attach doLayout function to window onload and onresize event using this piece of code:
[js]
$(window).ready(function() {
myFluidGrid.doLayout();
}).resize(function() {
myFluidGrid.doLayout();
});
[/js]
[html]
<html>
<head>
<title>Fluid grid</title>
<link rel="stylesheet" type="text/css" href="style/reset.css" />
<style type="text/css">
body {
position: relative;
width: 100%;
}
.box {
background-color: #F0F0F0;
color: #888;
font-family: Arial, Tahoma, serif;
font-size: 13px;
}
.box p {
padding: 10px;
}
.box span {
float: left;
font-size: 26px;
font-weight: bold;
}
div.alt {
background-color: #CCC;
}
</style>
<script type="text/javascript" src="script/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
var myFluidGrid = {
COLNUMBER : 2, // Minimum column number.
COLMARGIN : 10, // Margin (in pixel) between columns/boxes.
COLWIDTH : 240, // Fixed width of all columns.
doLayout : function() {
var self = this;
var pointer = 0;
var arr = [];
var columns = Math.max(this.COLNUMBER, parseInt($('body').innerWidth() / (this.COLWIDTH + this.COLMARGIN)));
$('.box').css('position', 'absolute').css('width', this.COLWIDTH + 'px');
$('.box').each(function() {
var tempLeft = (pointer * (self.COLWIDTH + self.COLMARGIN));
$(this).css('left', tempLeft + 'px');
var tempTop = 0;
if (arr[pointer]) { tempTop = arr[pointer]; }
$(this).css('top', tempTop + 'px');
arr[pointer] = tempTop + $(this).outerHeight() + self.COLMARGIN;
pointer++;
if (pointer === columns) { pointer = 0; }
});
}
};
$(window).ready(function() {
myFluidGrid.doLayout();
}).resize(function() {
myFluidGrid.doLayout();
});
</script>
</head>
<body>
<div class="box"><p><span>01</span>This is box number 1...</p></div>
<div class="box alt"><p><span>02</span>This is box number 2...</p></div>
<div class="box"><p><span>03</span>This is box number 3...</p></div>
<div class="box alt"><p><span>04</span>This is box number 4...</p></div>
<div class="box"><p><span>05</span>This is box number 5...</p></div>
<div class="box alt"><p><span>06</span>This is box number 6...</p></div>
<div class="box"><p><span>07</span>This is box number 7...</p></div>
<div class="box alt"><p><span>08</span>This is box number 8...</p></div>
<div class="box"><p><span>09</span>This is box number 9...</p></div>
</body>
</html>
[/html]
At the end, your page will look pretty much like this illustration below: (try resizing the browser window to see how the fluidity works)
[caption id="attachment_2573" align="aligncenter" width="500" caption="End result, nice and fluid!"]
[/caption]
Similar posts: BUY Gentamicin Eye Drops ONLINE WITHOUT PRESCRIPTION. BUY Lasix ONLINE WITHOUT PRESCRIPTION. Japan, craiglist, ebay, overseas, paypal. Canada, mexico, india.
Trackbacks from: BUY Female Cialis ONLINE WITHOUT PRESCRIPTION. BUY Female Cialis ONLINE WITHOUT PRESCRIPTION. Order Female Cialis no prescription. Buy Imodium from canada. Buy Motilium ONLINE WITHOUT prescription.