简体   繁体   English

滚动左栏,剩余屏幕高度为100%,滚动问题

[英]Scrollable left column w/ 100% remaining screen height, scroll issue

I'm trying to create a scrollable left column that takes up 100% of the remaining space, minus the distance from the top of the page. 我正在尝试创建一个可滚动的左列,该列占用100%的剩余空间,减去距页面顶部的距离。 It works well currently, but there's a few issues. 它目前运行良好,但存在一些问题。 When I initially created it, I ran into an infinite scrolling issue because I wasn't taking into account the footer height: 最初创建它时,由于没有考虑页脚高度,因此遇到了无限滚动问题:

http://jsfiddle.net/sUqtD/5/ http://jsfiddle.net/sUqtD/5/

If I subtract the height of the footer: 如果我减去页脚的高度:

http://jsfiddle.net/sUqtD/4/ http://jsfiddle.net/sUqtD/4/

it works to an extent, but if I resize the browser height, and the right column height pushes the footer down, the left column height still takes into account the footer height. 它在一定程度上起作用,但是如果我调整浏览器高度的大小,并且右列高度将页脚向下推,则左列高度仍会考虑页脚高度。

So my question, how can I get the left column to take up 100% remaining height in all conditions? 所以我的问题是,在所有情况下,如何使左列占据100%的剩余高度?

Try something like that: http://jsfiddle.net/mXjLE/1/ 尝试类似的方法: http : //jsfiddle.net/mXjLE/1/

Its not code perfect, but it works (I things). 它不是完美的代码,但是可以工作(我有事)。

You only had some minor errors. 您只有一些小错误。 The example you made where you subtracted the footer was close but you stil need to configurate your CSS as well.. 在减去页脚的示例中,该示例很接近,但是您仍然需要配置CSS。

Take a look at the code I made.. It works and takes the footer into account even if you decide to change it.. ( it is only a minor rewrite of your code.) 看一看我编写的代码。即使您决定更改它,它也会起作用并考虑页脚。.(这只是对代码的较小重写。)

Hope it helps http://jsfiddle.net/sUqtD/20/ 希望对您有所帮助http://jsfiddle.net/sUqtD/20/

EDIT There is a error when the window size is smaller than the left column - but I'll solve this asap :) 编辑窗口大小小于左列时出现错误-但我会尽快解决:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM