【发布时间】:2012-10-06 00:45:53
【问题描述】:
我正在尝试使用 Jquery 将外部网页加载到 div (#siteloader) 中,但我无法弄清楚如何调整 div 的高度以便重新调整大小以适应外部网站的内容,而无需获取滚动条。我绝对不想使用 iframe。
代码如下:
<!doctype html>
<html>
<meta charset="utf-8">
<title>Load remote content into object element</title>
<style type="text/css">
object {
width: 100%;
}
</style>
</head>
<body>
<div id="siteloader"></div>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script>
$("#siteloader")
.html('<object data="https://system.netsuite.com/pages/customerlogin.jsp?country=US">');
</script>
</body>
</html>
对此的任何帮助将不胜感激!
【问题讨论】:
-
我用 iframe 做了同样的事情。因为我可以控制外部 HTML,所以我添加到页面函数 set_iframe_height(w) P $('#iframe-element').height(w);并在嵌入页面中我添加了 parent.set_iframe_height($('body').height());