2013-01-10 46 views
0

我做了一個播放列表,從XML文件中提取信息。通過單擊超鏈接來調用視頻。我正在嘗試添加colorbox,並且我已經得到了一個盒子,但無法弄清楚我的生活如何讓視頻打開到彩盒中。下面是使用代碼IM:jQuery的的colorbox頭痛

$(function() { 
    /* be sure data is defined here */ 
$(data).find("chapter").each(function() { 

    var $chapter = $('<li class="chaptertitle"/>') 
    .append('<img class="img-swap" src="http://sandbox.kalliance.com/demo/images/plus.png" class="img-swap" />') 
    .append('<p align="left" class="pc-left">' + $(this).attr("label") + '<p align="right" class="pc-right">Duration</p>') 
    .append('<ul/>') 
    .appendTo('#screens'); 
    $(this).find('screen').each(function() { 
     time=$(this).find('screen').attr('duration') 
     $("#screens").append(time) 
     $('#screens ul:last') 
     .append('<li class="screentitle"/>') 
     .find('li:last') 
     .append('<p align="left" class="p-left"><a href="'+streamer+''+filenum+'/streams/_definst_/' + $(this).attr('path') + '" id="colorbox-load">' + $(this).attr('label') + ' </a></p> <p align="right" class="p-right">'+ $(this).attr("duration")+'</p>'); 

     //tgonzalez - create the modal window for the video 

     $("#colorbox-load").click(function() { 
     $.colorbox({inline:true, width:960, height:540, opacity:0.8 }); 

回答

0

顏色框API需要一個容器,其試圖在顏色框,打開的參考。試試這個

$.colorbox({href: "#divIdHere", inline:true, width:960, height:540, opacity:0.8 }); 
+0

我試過你的建議,甚至在主html頁面爲id =「player」創建了一個div,但它仍然顯示一個空白的方塊。 – user1870635