What’s wrong with this code?
$(function size() {
var width = document.width;
$('.section').css('width', 2 * width);
$('body').css('width', 8 * width).css('font-size', 0.023 * width);
$('.center').css('width', width);
$('#title').css('width', 0.78 * width);
$('#lf').css('width', 0.56 * width);
});
$(window).ready(size);
Please help! I’ve got no idea what is wrong :/
document.widthis marked obsolete in MDN, usedocument.body.clientWidthinstead.Also isn’t the
$(window).ready(...)is not valid jquery, do you mean$(window).load()?although as the first block of code is registering a handler in the same way as
$(document).ready(...)would, then the second call is not needed.