自拍亚洲一区欧美另类,亚洲成人影院,亚洲午夜久久久久妓女影院,最近中文字幕高清中文字幕无,亚洲熟妇av一区二区三区漫画

學習筆記

精準傳達 ? 價值共享

洞悉互聯(lián)網(wǎng)前沿資訊,探尋網(wǎng)站營銷規(guī)律

使用iframe之后點擊里面的鏈接只在當前子頁面跳轉

作者:狐靈科技 | 2019-12-23 12:12 |點擊:

設置子頁面的a標簽的target跳轉方式為:_parent或_top

<script type="text/javascript">
$(document ).ready(function(){
    $("a" ).attr("target" , "_parent" ); //_top
});
</script>

注意該代碼應該加在需要加載的iframe 框架里面

示例:


 
  <iframe src="/ceshi" frameborder="0" scrolling="no" id="test" width="100%" onload="this.height=100"></iframe>
  <script type="text/javascript">
  function reinitIframe(){
  var iframe = document.getElementById("test");
  try{
  var bHeight = iframe.contentWindow.document.body.scrollHeight;
  var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
  var height = Math.max(bHeight, dHeight);
  iframe.height = height;
  console.log(height);
  }catch (ex){}
  }
  window.setInterval("reinitIframe()", 200);
  </script>

 
上方的橙色js代碼 是iframe 自適應高度的 

例如 頁面中調用的是ceshi這個文件夾 代碼應該加載ceshi文件夾中

加主頁沒有試過 感興趣的可以試一下
如沒特殊注明,文章均為狐靈科技原創(chuàng),轉載請注明?? "使用iframe之后點擊里面的鏈接只在當前子頁面跳轉
多一份免費策劃方案,總有益處。

請直接添加技術總監(jiān)微信聯(lián)系咨詢

網(wǎng)站設計 品牌營銷

多一份參考,總有益處

聯(lián)系狐靈科技,免費獲得專屬《策劃方案》及報價

咨詢相關問題或預約面談,可以通過以下方式與我們聯(lián)系

業(yè)務熱線:15082661954 / 大客戶專線:15523356218