2013-01-20 59 views
0

Folk's, 我正在使用Fancybox和Jwplayer來顯示與照片一樣的視頻。我的問題是,導航欄不會永遠隱藏。此外,視頻調整從768px(原始大小)到725px(顯示大小),我不知道爲什麼。下面是代碼: HTMLFancybox中的JW播放器。無法隱藏控制欄

<a class="video" href="../img/advertising/img/video/NEOCLAIM_Femme.flv" title="NEOCLAIM Femme"><img src="../img/advertising/ico/ic02-neocalmF.jpg" alt="" /></a> 

和JS

$("a.video").click(function() { 
    $.fancybox({ 
    'scrolling' : 'no', 
    'padding' : 0, 
    'title' : this.title, 
    'type' :'swf', 
    'content': '<embed src="../jwplayer/player.swf?file='+this.href+'&amp;autostart=true&amp;fs=1" type="application/x-shockwave-flash" width="768" height="432" wmode="opaque" allowfullscreen="true" allowscriptaccess="always"></embed>', 
    helpers : { 
     overlay : { 
      css : { 
       'background' : 'rgba(0, 0, 0, 1)' 
      } 
     } 
    }    
    }); 
    return false; 
    }); 

我是一個初學者,不能找出解決辦法。 謝謝你的幫助。 這裏是一個鏈接到頁面After this link you must click on the first thumbnail

回答

1

這不是一個真正的fancybox問題,但你可能已經在LongTail支持論壇上找到的東西。

如果要隱藏(並顯示懸停)的JWPlayer控制欄,只需將它放在「」通過Flash變數controlbar=over ...所以控制欄會自動隱藏,當鼠標如果您在播放視頻時將其懸停並顯示。

在另一方面,你可以使用(HTML5)data-*屬性通過每個視頻的具體尺寸在你的鏈接,如:

<a data-width="352" data-height="270" class="video" href="../img/advertising/img/video/NEOCLAIM_Femme.flv" title="NEOCLAIM Femme"><img src="../img/advertising/ico/ic02-neocalmF.jpg" alt="" /></a> 

...(使用每一個正確widthheight值視頻),並在你的fancybox腳本,防止自動調整大小使用API​​選項fitToView: false ....然後捕獲每個視頻的尺寸使用afterLoad回調。

你充分的fancybox自定義腳本應該是這樣的:

$(document).ready(function() { 
    $(".video").fancybox({ 
    padding : 0, 
    fitToView: false, // fancybox won't auto-resize to fit in viewport 
    content: '<span></span>', // create temp content 
    scrolling: 'no', 
    helpers : { overlay : { css : { 'background' : 'rgba(0, 0, 0, 1)' } } }, 
    afterLoad: function() { 
     var $width = $(this.element).data('width'); // get dimensions from data attributes 
     var $height = $(this.element).data('height'); 
     // replace temp content 
     this.content = "<embed src='jwplayer.swf?file=" + this.href + "&autostart=true&amp;wmode=opaque&amp;controlbar=over' type='application/x-shockwave-flash' width='" + $width + "' height='" + $height + "'></embed>"; 
    } 
    }); 
}); // ready 

... 通知,我們的目標this.content的字符串增值controlbar=over。另請注意,我們並未使用.click()方法,但將fancybox直接綁定到選擇器.video。此外,我們實際上並不需要'title' : this.title'type' :'swf',所以我刪除它們。

演示? ... see it here

+0

太棒了,一切正常!非常感謝,我學習,我學習... –