【发布时间】:2016-11-14 05:59:51
【问题描述】:
$('#song-link').change(function () {
var link = $('#song-link').val();
SC.oEmbed(link, {
element: document.getElementById('putTheWidgetHere')
});
});
<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>
代码帮助我预览 soundcloud 的链接。你可以测试它的工作正常。但我想将其高度从400px 更改为200px。我尝试添加addclass() 和css()。但它没有用。
我无法确定哪个事件会触发这些函数,因为必须在将链接粘贴到输入文本并加载到 soundcloud 加载的iframe 上之后设置高度。
【问题讨论】: