【概述】
jquery.fancybox.js与jquery搭配使用,可弹出图片/视频等。
【实现播放视频】
想实现点击图标,弹出窗口播放视频的效果:
代码:
这个data-type很重要,可定义为iframe或video
<a href="https://player.youku.com/embed/XMTI4NTI3MDA1Ng==" data-type="iframe" class="overlay-link lightbox-image video-fancybox"><i class="flaticon-play-arrow"></i></a>
if($('.lightbox-image').length) {
$('.lightbox-image').fancybox({
openEffect : 'fade',
closeEffect : 'fade',
helpers : {
media : {}
}
});
}