来自我的博客
在目前的大部分设计中,管理系统仍然不可忽视的一项重要功能就是侧边功能栏,然而在侧边功能栏上的开发,也绕过了许多的弯路
js侧边栏
在我新手时期,也写过许多的侧边栏,侧边栏的要求很简单,和屏幕高度保持一致,并且功能项能在内部进行滚动,当时的我也是煞费苦心,为了能够准确地自适应,不得不用js去进行实现
$(window).resize(function(){
let sidebar = $('#dashboard-sidebar');
sidebar.css('height', 'auto');
let h = Math.max(sidebar.outerHeight(), $(window).height() - $('#header').height());
sidebar.css('height', h);
}).resize();
可以说