2012-05-15 28 views
2

上裝載酒吧工作,我有視頻的數組,每個都有自己的大拇指激活它們,陣列中的全部。我也有視頻的進度條,顯示他們已經多遠播放(狀態,我猜),我已經設法把一個一個的每個大拇指。我的問題是我怎麼做,所以每個拇指只得到了它的視頻進度條,並全部六個不立刻熄滅。視頻數組

回答

0

一個簡單的辦法是設置你的每一個進度條有順序編號的ID和當前正在播放的視頻的索引存儲在一個變量,這樣就可以使用該值的目標使用jQuery適當的進步元素:

HTML:

<div id="progress_1"><!-- any markup required for my progress bar --></div> 
<div id="progress_2"><!-- any markup required for my progress bar --></div> 
<div id="progress_3"><!-- any markup required for my progress bar --></div> 

jQuery的

// Update this with the index of the currently 
// playing video when the user clicks a thumb 
var currentVideoIndex = 0; 

// Use the currentVideoIndex to target the progress bar related to 
// the currently playing video 
$('#progress_' + currentVideoIndex).css('width', percent); 
+0

嗯,那裏將這些放在哪裏? (對不起,我normaly使用HTML,而不是thew腳本工作,所以我很困惑很多:() –

+0

放在你的每一個進度條的根HTML元素的識別碼與存儲當前視頻的索引中的變量在你的JavaScript代碼,希望編輯能讓它更清晰。 –