我試圖用Jquery將外部網頁加載到div(#siteloader)中,但我很難找出如何調整div的高度,以便重新調整大小適合外部網站的內容而不需要滾動條。我絕對不想使用iframe。在div中加載外部網頁並調整高度
下面是代碼:
<!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()); – galchen