使用javascript和css设置DIV的滚动高度 [英] Setting scroll height of a DIV using javascript and css
本文介绍了使用javascript和css设置DIV的滚动高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个div,当一个动作被触发时弹出。当我向下滚动页面时,它仍然保持在页面顶部。我想设置滚动高度,使其在相对于页面滚动的相对位置移动。只是使位置:相对不工作。我如何使用javascript得到这个?帮助。
I have this div which pops up when an action is triggered. When I scroll down the page, it still remains on top of page. I want to set the scroll height so it moves in relative position to the page scroll. Simply making the position : relative does not work. How can I use javascript get this? Help.
<form name="" action="" method="POST">
<div id='divSearchAndReplace'>
<table id='divSearchAndReplace_Header' width='100%'>
<tr>
<td>
<table>
<tr>
<td align='left'></td>
</tr>
</table>
</td>
</tr>
</table>
<table width='100%' border='0' cellspacing="4" cellpadding="2">
<tr><td colspan='2' nowrap height='10px'></td></tr>
<tr valign="top">
</tr>
<tr><td colspan='2' align='right' style='padding-right:12px;'><input class='form_button' type='submit' name='btnSubmit' value='Replace' onclick='return checkSearchAndReplace();'/></td></tr>
</table>
</div>
</form>
这是css
#divSearchAndReplace { width:450px; height:240px; border:1px solid #336699; background-color:#ffffff; position:absolute; left:200px; top:75px; display:none; }
#divSearchAndReplace table { width:450px; border:0px; align:center; }
推荐答案
> position:fixed in CSS?
Are you maybe looking for position: fixed
in CSS?
这篇关于使用javascript和css设置DIV的滚动高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文