[jQuery] binding to two events (resize and onload)
Hi there
I have a wacky fix to the age old problem of fluid column widths (a
table would do of course). It involves using jquery to calculate the
sizes of my columns - the splitter code is a bit over the top for my
needs. So I have some simple code but I can't seem to get it to work.
$(document).bind("ready", resizeCols);
$(document).bind("resize", resizeCols);
function resizeCols() {
//Get full width of central col
var divWidth = $('#col-centre').width();
//now main should always be 80% and side 205px
mainWidth = divWidth - 205;
alert(mainWidth);
$('#main-content').width(mainWidth);
}
The alert doesn't show at all and Im not entirely sure why - I don't
get any errors showing up. My guess is that Im binding wrong - any
suggestions?
Thanks
Will