首页 > 技术文章 > iframe切换src后高度自适应

darkclouds 2020-08-08 21:40 原文

  1. 绑定onload函数
    onload="this.height=this.contentWindow.document.body.scrollHeight;"
  2. 切换iframe的src前,更改它的高度
    $("#contentFrame0").attr('height', 'auto');

推荐阅读