var windowV = $(document); //var bodyV = $("body"); //var reportV = $("body > div"); var contentV = $("#content-container"); var divV = $("#content-container > div > div:nth-child(1)");
//bodyV.css("overflow","hidden"); //reportV.css("overflow","hidden"); contentV.css("overflow","hidden");//隐藏滚动条
var windowWidth = windowV.width();//获取窗口宽度 var divWidth = divV.width();//获取div宽度 var changeValue = windowWidth/divWidth;//窗口与div比值
var childs = divV.find("*").each(function(){//改变所有子辈、孙子辈宽度 $(this).width($(this).width()*changeValue); });
$(window).resize(function () { //当浏览器大小变化时 var windowWidth = windowV.width();//获取窗口宽度 var divWidth = divV.width();//获取div宽度 var changeValue = windowWidth/divWidth;//窗口与div比值 var childs = divV.find("*").each(function(){//改变所有子辈、孙子辈宽度 $(this).width($(this).width()*changeValue); }); });
|