我想通过用导航的宽度减去窗口的宽度来计算元素的宽度(#content)。其实我不知道我的代码失败了。如果有人可以帮助我,那就太好了!
$(function () {
$(window).resize(function () {
var widthWindow = $(window).width();
var widthNav = $("nav").width();
$("#content").css({ "width": widthWindow - widthNav });
// Put the console log here
console.log(widthWindow, widthNav);
}).resize();
});