我有一张从Soundcloud //connect.soundcloud.com/sdk.js
var song = 0;
function artwork() {
$(document).ready(function() {
SC.get("/users/user/favorites", function(track){
$('#soundcloudimage').css('background-image', 'url(' + track[song].artwork_url.replace('large', 't500x500') + ')');
});
});
然后我有另一个功能改变了哪个曲目(song
)来获取艺术作品:
function changeSong() {
song = song + 1;
}
和html:
<div id="soundcloudimage"></div>
<button onclick="changeSong();">Next</button>
但是当我点击按钮时它当前什么也没做。我相信它需要刷新艺术品功能,但我希望它能够在不刷新整个页面的情况下完成这项工作吗?我怎么能这样做?
答案 0 :(得分:0)
if you want to call the artwork function again:
function changeSong()
{
song = song + 1;
artwork();
}