像 iframe 一样绝对定位
我有一个页面基本上是这样的:
<div id="thelist" style="height:100%; width:100%"></div>
<script type="text/javascript">
$('#thelist').load('other.aspx', function () { });
</script>
我遇到的问题是 other.aspx 上有很多包含绝对定位的控件,我应该是绝对的,但相对于 div 而不是页面。这些控件是动态生成的,因此它们的添加顺序可能与屏幕上显示的顺序不同。 iframe 是不可能的,因为 iPad 不允许您滚动 iframe。基本上我需要的是一种将绝对定位锚定到 div 而不是整个页面的方法。任何帮助表示赞赏。谢谢。
I have a page that is basically this:
<div id="thelist" style="height:100%; width:100%"></div>
<script type="text/javascript">
$('#thelist').load('other.aspx', function () { });
</script>
the problem that I'm running into is that other.aspx has a lot of controls on it that contain absolute positioning, which I was to be absolute, but with respect to the div and not to the page. The controls are generated dynamically so they may be added in a different order than they will appear on the screen. Iframes are out of the question because the iPad does not allow you to scroll iframes. Basically what I need is a way to anchor the absolute positioning to the div instead of the entire page. Any help is appreciated. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您给包含元素“位置:相对”时,其中绝对定位的元素将使用该容器作为参考点。因此,其中的位置“top: 0; left: 0”是容器的左上角,而不是整个窗口。
When you give a containing element "position: relative", then absolutely-positioned elements inside it use that container as the reference point. So, inside it the position "top: 0; left: 0" is the upper left corner of the container, not the whole window.