Fancybox video highlight with nothing in rails

爷,独闯天下 提交于 2019-12-25 02:53:43

问题


I need to play videos in fancybox.

As per this solution

I started working

My a href tag looks like

 <a class="fancybox" href="/uploads/ckeditor/attachments/55/myvideo.mp4">
<img class="check" height="120" weight="160" src="/uploads/ckeditor/attachments/55/myvideo.jpg" alt="Myvideo">
</a>

and my jquery

      $(document).ready(function () {
        $("a.fancybox").fancybox({
          fitToView: false, 
          content: '<span></span>', 
          scrolling: 'no', 
   afterLoad: function (){
        this.content = "<embed src='/jwplayer.swf?file=" + this.href + "&autostart=true&amp;wmode=opaque' type='application/mp4' width='140' height='180'></embed>"; 
      }
        });
        }); 

While ckick on that image it fancybox responds with nothing. No error in console and browser

my fancybox content doesn't have apart from the following line

<div id="fancybox-content" style="border-width: 10px; width: 0px; height: auto;">

please help me. Thanks a lot in advance.


回答1:


This is worked for me finally.

$(document).ready(function() {
$(".fancybox").fancybox({
    type: "iframe",
    width : 380, // or whatever
    height: 280
}).trigger("click");
});​


来源:https://stackoverflow.com/questions/23191946/fancybox-video-highlight-with-nothing-in-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!