以下是顯示Spotify播放按鈕的jQuery代碼,當我點擊「Rock the house!」鏈接時當我點擊一個觸發它顯示的鏈接時,如何觸發Spotify Play按鈕播放?
$(function() {
$('#partystart').toggle(function() {
$(".fadeIn").addClass("party");
$("#musicbox").slideDown("300");
$("#partystart").html("<a id='partystart'>Take a break</a>");
}, function() {
$(".fadeIn").removeClass("party");
$(".fadeIn").addClass("fullopacity");
$("#musicbox").slideUp("300");
$("#partystart").html("<a id='partystart'>▲ Rock the house!</a>");
});
});
下面是HTML:
<div id="partybox" >
<iframe id="musicbox" style="margin-top: -2px; display: none;" src="https://embed.spotify.com/?uri=spotify:track:3QMLpta0AmeJLpWNmeyC6B#0:12" width="250" height="80" frameborder="0" allowtransparency="true"></iframe>
<a id="partystart">▲ Rock the house!</a>
</div>
下面是一個例子,可以讓你點擊玩了一圈軌道,而不是實際的Spotify裏面播放按鈕播放按鈕:http://spotifymusic.tumblr.com/
另外,我把#0:12
放在歌曲URI的末尾,讓歌曲在0:12秒開始播放,但似乎不起作用。我在那裏做錯了什麼?
謝謝!
順便說一下,我添加了HREF觸發軌跡如下: ▲ Rock the house! 的問題是,它只是觸發的時候,我沒有jquery的涉案 –