I am working on creating a grid of divs that will cover the entire viewport. To start, I want to have a grid that is 7 divs wide and 10 divs high.
Below is the code snippet I've written so far to set the size of the div elements:
function adjustHeight() {
var height = $(window).height();
height = parseInt(height) + 'px';
$(".page").css('height', height);
}
$(document).ready(function() {
adjustHeight();
$(window).bind('resize', adjustHeight);
});
function adjustWidth() {
var width = $(window).width();
width = parseInt(width) + 'px';
$(".page").css('width', width);
}
$(document).ready(function() {
adjustWidth();
$(window).bind('width', adjustWidth);
});
Currently, I have two divs stacked on top of each other, one in red and the other in black for visibility. Next, I plan to add content inside these divs. Additionally, I made sure to include the following CSS rule:
body {
margin: 0px;
}
In the future, I intend to incorporate scrolling features using jQuery. But for now, my main focus is on setting up the grid layout as desired.
Edit: Each individual div should be the size of the viewport.
Edit: I found this handy plugin for scrolling, which offers more functionality than a simple script placed at the end of the page.