1. css
.menu_wrapper{
width: 254px;
background: #282828;
position: fixed;
left: 0;
top: 0;
bottom: 0;
z-index: 100;
}
2.dom元素
3.js代码
// 初始化菜单高度
function setsize() {
var max_h = $(".menu_wrapper_inner").height();
var window_h = window.innerHeight;
var body_h = $("body").height();
if (max_h < window_h) max_h = window_h;
if (max_h < body_h) max_h = body_h;
$(".menu_wrapper").height(max_h);
setTimeout(function () { setsize(); }, 100);
}
setsize();
$(window).on('resize', function () {
setsize();
})