0
我有一個播放列表的jplayer音樂播放器,它應該可以工作,現在我希望能夠在點擊鏈接時將第一個myPlaylist1更改爲myPlaylist2。當點擊jQuery鏈接時更改div內容?
將第一個播放列表myPlaylist1加載到div #theplayer中的功能如下所示。
$(document).ready(function(){
var description = 'Some description. ';
$('#theplayer').ttwMusicPlayer(myPlaylist1, {
autoPlay:false,
description:description,
currencySymbol:'Kr ',
buyText:'KÖP',
tracksToShow:50,
jPlayer:{
swfPath:'http://www.mypage.com/music_player/jquery-jplayer' //You need to override the default swf path any time the directory structure changes
}
});
當我點擊一個鏈接,我想改變上述下方myPlaylist2:
$('#theplayer').ttwMusicPlayer(myPlaylist2, {
autoPlay:false,
description:description,
currencySymbol:'Kr ',
buyText:'KÖP',
tracksToShow:50,
jPlayer:{
swfPath:'http://www.mypage.com/music_player/jquery-jplayer' //You need to override the default swf path any time the directory structure changes
}
});
而與此,我希望playlist2將顯示,而不是playlist1?
時加載的頁面加載看起來像這樣的播放列表:
var myPlaylist1 = [
{
mp3:'http://www.www.mypage.com/music_player/mix/1.mp3',
title:'Love The Way You Lie',
artist:'Eminem',
buy:'#',
price:'12',
cover:'http://www.mypage.com/music_player/images/1.jpg'
}
];
當點擊鏈接,我喜歡的播放列表改變這個代替。
var myPlaylist2 = [
{
mp3:'http://www.www.mypage.com/music_player/mix/2.mp3',
title:'Hey you',
artist:'Madonna',
buy:'#',
price:'12',
cover:'http://www.mypage.com/music_player/images/2.jpg'
}
];
或者,如果您有任何其他建議如何更改播放列表?
任何輸入真的很感激,謝謝!
感謝tehlulz,我的。點擊(函數後添加一個警告,看它是否運行並顯示警報,但它不會改變播放列表我害怕。 – 2012-04-18 08:55:50