【发布时间】:2012-05-21 01:23:25
【问题描述】:
我有一个 div,其中包含左对齐的菜单和右对齐的 iframe,还有一个用于显示/隐藏 div 的滑动切换按钮,我想做的是让 iframe 在 div 消失时自动调整大小占据页面的整个宽度,并在出现时为 div 留出空间,我该如何实现?
<script>
$(document).ready(function(){
$(".flip").click(function(){
$(".mmenu").slideToggle("slow");
});
});
</script>
<button class="flip">Show.Hide menu</button>
<div id="nav" class="mmenu" style="float: left; border-radius: 10px; position: fixed;
bottom: 75px;border: 5px solid #003366; bottom: 50px;">
<ul type="none">
<li><a target="collabsoft" href= "ProfilePage.php?property_variable=mine">My Profile</a></li>
<li><a target="collabsoft" href= "viewMessages.php">Messages</a></li>
<li><a target="collabsoft" href= "userHomepage.php">My Conferences</a></li>
</ul>
</div>
<iframe scrolling="no" id="collabsoft" name="collabsoft" src="latestNews.php" style="position: relative;
width: 950px; height: 100%;></iframe>
【问题讨论】:
-
你为什么使用 iframe?这可能会影响解决方案。
-
@Blowski 我必须使用 iframe 在其中加载网站的内容。
-
为什么内容没有直接加载到页面中,而不是在 iframe 中? iframe 有各种各样的问题,你应该将它们作为最后的手段。
-
你在 iframe 上有一个固定的宽度(950px)所以改变宽度不会发生,你也需要在那个 iframe 上关闭 ",加上按钮在 iframe 的左边,它也占用空间
标签: javascript jquery iframe html autoresize