0
我遇到了一個正在處理的網站問題。 http://peterseabrook.com/galaxias2/。頁面上的兩個jQuery應用程序一次只能工作一個?
我有兩個JavaScript腳本執行一些jQuery,但只有1將工作在一個時間取決於哪些代碼首先爲時鐘或jPlayer無線電。
我不知道該怎麼辦。
CODE:
jQuery(document).ready(function($){
$('#clock_sydney').jClocksGMT({offset: '+11'});
$('#clock_greece').jClocksGMT({offset: '+3'});
});
jQuery(document).ready(function($){
var stream = {
title: "Galaxias Radio",
mp3: "http://78.46.52.186:18272/;/stream/1"
},
ready = false;
$("#jquery_jplayer_1").jPlayer({
ready: function (event) {
ready = true;
$(this).jPlayer("setMedia", stream);
},
pause: function() {
$(this).jPlayer("clearMedia");
},
error: function(event) {
if(ready && event.jPlayer.error.type === $.jPlayer.error.URL_NOT_SET) {
// Setup the media stream again and play it.
$(this).jPlayer("setMedia", stream).jPlayer("play");
}
},
swfPath: "http://peterseabrook.com/galaxias2/wp-content/themes/canvas/js/jplayer",
supplied: "mp3",
preload: "none",
wmode: "window",
useStateClassSkin: true,
autoBlur: false,
keyEnabled: true
});
$("#jplayer_inspector").jPlayerInspector({jPlayer:$("#jquery_jplayer_1")});
}); 在此先感謝你們,
Peter。
我不知道它是否會影響到您,但JavaScript是單線程的:只有一個代碼在給定的時間運行。 – 2015-02-06 01:45:52