微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Jquery – 在内部使用iframe调整或拖动DIV

尝试在此示例中调整DIV的大小 – > http://jsbin.com/ixesak/edit#preview

光标在Youtube-Player上移动(在调整大小或拖动时),结果是调整大小功能停止.
希望可以有人帮帮我.

JS

$(document).ready(function()
{  
  $('#test').draggable().resizable(); 
});

HTML

<div id="test" style="padding:20px; background-color:#f00;">
  <iframe class="youtube-player" type="text/html" width="100%" height="100%" src="http://www.youtube.com/embed/NugRZGDbPFU?autoplay=1" frameborder="0"></iframe>
  </div>

更新:解决方案,但也许不是最好的?
http://jsbin.com/ixesak/7/edit

解决方法

drag iframe example

使iframeFix成为iFrame上的叠加层,因为iframe正在接管鼠标事件.设置iframeFix的宽度和高度,以便可以看到调整大小的句柄,并根据需要制作其他必要的css人员.

<div id="cont" style="height:1000px; width:1000px; background-color:grey;">
    <div id="test" style="padding:20px; background-color:#f00;">
        <div id="iframeFix" style="display:block; background:transparent; position:absolute; width:100%; height:100%; z-index:9999999;"></div>
        <iframe class="youtube-player" type="text/html" width="100%" height="100%" style="z-index:2000!important;" src="http://www.youtube.com/embed/NugRZGDbPFU?autoplay=1" frameborder="0"></iframe>
    </div> </div>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐