简体   繁体   English

CSS全宽高度固定可滚动容器

[英]css full width height fixed scrollable container

I load a div thanks to pushstate history and I want to display it by sliding the div from the bottom to the top. 由于pushstate历史记录,我加载了一个div,我想通过将div从底部滑动到顶部来显示它。

For the sliding animation I use css3 transition triggered with jquery addclass. 对于滑动动画,我使用通过jquery addclass触发的css3过渡。

However, I have a lot of difficulties to obtain a full screen fix div container. 但是,我很难获得全屏修复div容器。 This container must be scrollable also. 此容器也必须是可滚动的。 The container doesn't fill all the screen with this css: 容器不会用此CSS填充所有屏幕:

html, body{
    position : relative;
    margin: 0;
    padding: 0;
    min-heigth: 100%;
}
#ajaxify_container {
    position: fixed;
    display: block;
    z-index: 9999;
    min-width: 100%;
    min-height: 100%;
    top: 100%;
    margin: 0;
    padding: 0;
    -webkit-box-shadow: 0px 0px 25px rgba(0,0,0,0.95);
    -moz-box-shadow: 0px 0px 25px rgba(0,0,0,0.95);
    box-shadow: 0px 0px 25px rgba(0,0,0,0.95);
    -webkit-transition: all 0.7s ease-in-out;
    -moz-transition: all 0.7s ease-in-out;
    -o-transition: all 0.7s ease-in-out;
    -ms-transition: all 0.7s ease-in-out;
    transition: all 0.7s ease-in-out;
} 
.ajaxify_container-animated {
    -webkit-transform: translateY(-100%);
    -moz-transform: translateY(-100%);
    -o-transform: translateY(-100%);
    -ms-transform: translateY(-100%);
    transform: translateY(-100%);   
}

Sorry for my English, I'm French 对不起,我是英语,我是法语

Actually min-height in html/body is useless, it should be height if you want to use min-height for #ajax-container. 实际上,html / body中的min-height是没有用的,如果要为#ajax-container使用min-height,则应该为height。

Beside, position:fixed refers to screen window. 在旁边,位置:固定是指屏幕窗口。 height100%; 身高100%; + width:100%; +宽度:100%; + overflow:auto; +溢出:自动; is plenty enough to fill the window and see it scroll if needed. 足够填满窗口,并在需要时看到它滚动。

Your fiddle updated : http://jsfiddle.net/j2Yqc/4/ 您的小提琴已更新: http : //jsfiddle.net/j2Yqc/4/

#single-container {
    min-height: 100%;
    padding:5px;
    background: rgb(33,35,37);
}

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

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