我試圖創建一個畫廊組,混合圖像和視頻與視頻使用JWPlayer6。Fancybox2與圖像和視頻在同一組使用JWPlayer 6
我每個人都作爲獨立的團隊工作,但我不能鍛鍊如何將兩者結合起來。
<!-- FancyBox to display images -->
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox({
helpers : {
title : { type : 'inside' }
}, // helpers
beforeLoad: function(){
}
});
});
<!-- FancyBox to display videos -->
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox-video").fancybox({
content: '<div id="video_container" style="">Loading video...</div><br>',
autoSize: true,
helpers : {
title : { type : 'inside' }
}, // helpers
beforeLoad: function(){
this.title = $(this.element).attr('caption');
},
afterShow: function(){
jwplayer("video_container").setup({
flashplayer: "/static/js/libs/jwplayerjwplayer.flash.swf",
file: this.href,
autostart: 'true'
}); // jwplayer setup
} // afterShow
}); // fancybox
}); // on
</script>
你有沒有嘗試將兩者以及兩者分開的例子? – emaxsaun 2013-03-11 16:52:38
它們都需要使用相同的選擇器並使用不同的'data-fancybox-type'屬性 – JFK 2013-03-11 17:58:19
...另外你還有一個額外的'return false; //防止默認值'無所作爲...複製/粘貼的缺點之一;) – JFK 2013-03-11 18:00:18