【发布时间】:2016-01-07 21:12:41
【问题描述】:
我的侧边栏有时比主页大,我尝试设置垂直溢出但垂直滚动条仍然没有出现。
/**
* Created by eduard on 07.01.2016.
*/
console.log("Height 1 ", sidebar_height);
if ($(window).height() < sidebar_height + 35) {
$('body').css('overflowY', 'auto');
//$("#sidebar").css('overflowY', 'auto');
console.log("Scrollbar should appear", $(window).height() - sidebar_height);
}
else {
console.log("Scrollbar should not appear", $(window).height() - sidebar_height);
}
为什么设置了垂直溢出,却没有出现垂直滚动条?
【问题讨论】:
-
尝试将其设置为滚动而不是自动。
-
@Styphon 将其设置为
scroll仍然不会使滚动条出现 -
你真的有固定高度吗?
-
我刚刚了解到我需要有一个固定的高度来设置滚动
标签: javascript html css