iframe加载时如何改变iframe的高度?

Sau*_*apa 9 html css iframe jquery

$('#song-link').change(function () {
  var link = $('#song-link').val();
  SC.oEmbed(link, {
    element: document.getElementById('putTheWidgetHere')
  });
});
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://connect.soundcloud.com/sdk/sdk-3.1.2.js"></script>
<input  id="song-link" placeholder="Paste Soundcloud link here" name="song_link"   type="text">
<div id="putTheWidgetHere"></div>
Run Code Online (Sandbox Code Playgroud)

代码帮助我预览soundcloud的链接.你可以测试它的工作正常.但我想它的高度从改变400px200px.我试过添加addclass()css().但它没有用.

我无法确定哪个事件会触发这些功能,因为必须在将链接粘贴到输入文本上并且在该iframesoundcloud加载时加载后才设置高度.

Pra*_*jal 2

尝试这个:

#putTheWidgetHere iframe {
    min-height: 200px;
    height: auto;
}
Run Code Online (Sandbox Code Playgroud)