最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Display html5 video tag in colorbox lightbox - Stack Overflow

programmeradmin2浏览0评论

I´m trying to display an HTML5 with a colorbox lightbox. The way I´m doing it is something like this:

var html ='<video>'+sources+'</video>';
$.colorbox({html:html});

where sources is a variable that contains the html of the source tags. My problem is that even though the colorbox lightbox appears, the video doesn't show. I've checked with Firebug and the whole html is there. Any idea why it might not show it?

Thanks.

I´m trying to display an HTML5 with a colorbox lightbox. The way I´m doing it is something like this:

var html ='<video>'+sources+'</video>';
$.colorbox({html:html});

where sources is a variable that contains the html of the source tags. My problem is that even though the colorbox lightbox appears, the video doesn't show. I've checked with Firebug and the whole html is there. Any idea why it might not show it?

Thanks.

Share Improve this question edited Jan 16, 2012 at 8:49 lgomezma asked Jan 13, 2012 at 16:39 lgomezmalgomezma 1,6472 gold badges16 silver badges30 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

You can display it using the inline html mode

$( document ).ready( function() {
    $( '#openColorbox' ).colorbox( {
        inline  : true, 
        width   : '80%', 
        height  : 'auto', 
        href    : '#inlinevideocontent'
    } );
} );

and here is your inline div

<div style='display:none'>
        <div id='inlinevideocontent' >
        <video controls="controls" src="video.mp4" />
        </div>
</div>
发布评论

评论列表(0)

  1. 暂无评论