【发布时间】:2010-05-25 07:06:27
【问题描述】:
我已经实现了一个聊天脚本,它需要一个绝对定位的 DIV 来包裹页面内容。
这是为了确保聊天窗口保持在底部。
问题在于,由于这个主包装器的绝对定位,所有其他绝对定位的元素(例如 Jquery 自动完成、日期选择器等)现在随着页面上下滚动。
以下是 HTML 示例:
<body>
<div id="main_container">
<div id="content">Elements like Jquery Autocompletes, Datepickers with absolute positioned elements in here</div>
</div>
DIV“main_container”样式如下所示:
#main_container {
width:100%;
background-color:#ffffff; /* DO NOT REMOVE THIS; or you'll have issue w/ the scrollbar, when the mouse pointer is on a white space */
overflow-x: hidden;
overflow-y: scroll;
height:100%; /* this will make sure that the height will extend at the bottom */
position:absolute; /* container div must be absolute, for our fixed bar to work */
}
我希望有一个简单的修复,因为聊天脚本太好了,无法摆脱。
谢谢,
提姆
【问题讨论】: