iframe在網頁應用相當的廣泛,但由於先天的限制下,以至於高度以及寬度都只能依所設定的大小為主,但經由後天的調整下,讓iframe也能依載入網頁內容的多寡,自動調整框架大小,iframe也是可以很smart的喔!
iframe.htm
<iframe frameborder="0" src="source.htm" id="frameid"></iframe>
source.htm(加在<head>….</head>之間
<script language="javascript">
function reSize(){
//parent.document.all.frameid.height=document.body.scrollHeight;
parent.document.getElementById("frameid").height=document.body.scrollHeight;
}
window.onload=reSize;
</script>
function reSize(){
//parent.document.all.frameid.height=document.body.scrollHeight;
parent.document.getElementById("frameid").height=document.body.scrollHeight;
}
window.onload=reSize;
</script>
Switch《寶可夢 Z-A》好啦魷怎麼進化?翻轉螢幕即可進化成烏賊王
Cloudflare Drop 拖曳就能部署網站,還可綁定網域與SSL
線上象棋對戰遊戲室|免註冊立即入座,真人即時對戰
樹莓派系統安裝教學|設定 Raspberry Pi OS、SSH 與首次登入
自製 GA4Exact 外掛,讓 WordPress 後台直接查看 GA4 分析報表
解決 WooCommerce Checkout Block 導致金流模組無法顯示的問題