Jquery计算百分比宽度减去不返回弹性列的像素
我试图通过使用jquery绕过css calc问题(因为calc在Explorer上不起作用) 但是,当我设置宽度减去像素时,列不再具有弹性,所有内容都在JSFIDLE上重叠(当我从textedit测试它时很好),请注意,我需要将列的左侧和中部作为固定位置,以便在内容溢出时,只有右侧的列向下滚动 有什么想法吗 非常感谢 CSS:Jquery计算百分比宽度减去不返回弹性列的像素,jquery,fluid-layout,css,Jquery,Fluid Layout,Css,我试图通过使用jquery绕过css calc问题(因为calc在Explorer上不起作用) 但是,当我设置宽度减去像素时,列不再具有弹性,所有内容都在JSFIDLE上重叠(当我从textedit测试它时很好),请注意,我需要将列的左侧和中部作为固定位置,以便在内容溢出时,只有右侧的列向下滚动 有什么想法吗 非常感谢 CSS: html, body { width:100%; margin:0; padding:0; font-size:87.5%; } .middle { pos
html, body { width:100%; margin:0; padding:0; font-size:87.5%; }
.middle {
position:fixed;
margin-top:20;
margin-left:170;
background:yellow;
margin-bottom:20px;
margin-right:40px;
}
.left {
position:fixed;
top:20px;
left:20px;
background:blue;
width:130px;
}
.right {
float:right;
background:blue;
margin: 20px 20px 20px 0;
}
<div class="left"></div>
<div class="middle"></div>
<div class="right"></div>
$(document).ready(function () { /* standard jQuery document ready */
$('.left').css('height', '100%').css('height', '-=40px');
$('.middle').css('width', '40%').css('width', '-=20px');
$('.middle').css('height', '100%').css('height', '-=40px');
$('.right').css('width', '60%').css('width', '-=190px');
$('.right').css('height', '100%').css('height', '-=40px');
});
HTML:
html, body { width:100%; margin:0; padding:0; font-size:87.5%; }
.middle {
position:fixed;
margin-top:20;
margin-left:170;
background:yellow;
margin-bottom:20px;
margin-right:40px;
}
.left {
position:fixed;
top:20px;
left:20px;
background:blue;
width:130px;
}
.right {
float:right;
background:blue;
margin: 20px 20px 20px 0;
}
<div class="left"></div>
<div class="middle"></div>
<div class="right"></div>
$(document).ready(function () { /* standard jQuery document ready */
$('.left').css('height', '100%').css('height', '-=40px');
$('.middle').css('width', '40%').css('width', '-=20px');
$('.middle').css('height', '100%').css('height', '-=40px');
$('.right').css('width', '60%').css('width', '-=190px');
$('.right').css('height', '100%').css('height', '-=40px');
});
试试这个:
$('.middle').css('width', '100%').css('width', '-=260px');
$(window).on('resize', function(){
$('.middle').css('width', '100%').css('width', '-=260px');
});
令人惊叹的。我也想过类似的事情。