jquery - 更改 fancybox 设计 - 添加另一个不晃动窗口的 div

标签 jquery html css fancybox fancybox-2

我在 Fancybox 窗口上安装了 JW 播放器。一切正常,现在我只有一个设计问题:

当显示播放器窗口时(当它触发时),它会“自下而上”移动,从下向上移动到窗口。这是因为我在播放器下添加了另一个div。我怎样才能解决这个问题? 这是一个演示示例:http://teodore.ge/test/demo/

我是这样做的:

<script>

      $(".fancybox").fancybox({
        fitToView: false, // to show videos in their own size
        content: '<div></div>', // create temp content
        scrolling: 'no', // don't show scrolling bars in fancybox
        afterLoad: function () {

          // get dimensions from data attributes
          var $width = $(this.element).data('width'); 
          var $height = $(this.element).data('height');


          var link=$(this.element).context.attributes.yutubelink.nodeValue;

          this.content = ' <embed type="application/x-shockwave-flash"  src="player.swf" width="640" height="383"    style="undefined"  allowfullscreen="true" allowscriptaccess="always" wmode="opaque" flashvars="file='+link+'&amp;skin=nacht.zip&amp;autostart=true">'; 
        },
        afterShow: function(){
          var toolbar = "<div id='tools'>" + $("#appendContent div").eq(this.index).html() + "</div>";
           $(".fancybox-outer").append(toolbar);
          }
      });   

</script>


<div id="appendContent" style="display: none;  width: auto; height: auto;">
    <div > 1111   That div  is the problem <br><br><br>  1111111 <br> <br> </div>
    <div> 2222:  That div  is the problem  <br><br><br> 2222222 <br> <br> </div>
</div>



    <a class="fancybox"  yutubeLink="http://www.youtube.com/watch?v=p3iYnHx8P0s" > 
    <img src=" 1.jpg"  width="360" height="240"></a><br>

    <a class="fancybox"  yutubeLink="http://www.youtube.com/watch?v=USgLNBsnRGo"> 
    <img src=" 2.jpg" width="360" height="240"></a> <br>

最佳答案

我将添加新 div 的功能移动到播放器旁边。我将函数从 afterShow() 移至 afterLoad() 函数。加载后添加 div 会导致该问题(它会更改 div 的位置)。因为播放器必须在屏幕的中心,当我添加一个新的 div 时,那个位置正在改变。

关于jquery - 更改 fancybox 设计 - 添加另一个不晃动窗口的 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15890206/

相关文章:

html - 尝试嵌入没有指向 youtube 的链接的 youtube 视频

css - React 使用来自另一个标签的 onClick 更改 className 的样式

javascript - 我如何将从 javascript 添加的多个元素分离到我的 HTML 中?

javascript - 无法捕获 CKEditor 更改事件

javascript - 使用书签自动填写表单

javascript - Google Chrome - 在不需要时提供翻译

javascript - 无限自动播放纯 css 轮播

javascript - 如何使用 JS 对列表或其他元素进行排序?

jQuery 垂直新闻行情插件但可控

javascript - 日期计算的奇怪错误