【发布时间】:2018-12-30 17:37:22
【问题描述】:
我在主站点中有一个 iframe(这是一个机器人图标)。我无法使用 jqueryui draggable() 函数使 iframe 元素可拖动。
下面是sn-p的代码
$("#testIframe").draggable();
#testIframe {
position: absolute;
bottom: 0;
right: 0;
background: #ccc;
padding: 10px;
width: 200px;
height: 100px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<div class="parent">
Parent text....
<div class="child">
<iframe id="testIframe" width="100%" height="300" src="//jsfiddle.net/iamraviteja/09hdej6t/2/embedded/" frameborder="0"></iframe>
</div>
</div>
我的问题:如果您尝试拖动
testIframe,则无法拖动它。为什么?
【问题讨论】:
-
实际上你的 iframe 在这个例子中是可拖动的?它在这里有效,但在您的页面上无效还是有什么问题?
-
不能在小提琴中工作。这与我在页面中所面对的相似。
-
如果你拖动灰色边框是可能的,这就是我问的原因!
-
好吧,它不能在 chrome 中工作,但可以在 Firefox 甚至是糟糕的 Internet Explorer 中工作!看起来 chromes adblocker 正在阻止拖动事件!
-
我收到了您的问题,并更新了您的问题以进行澄清。
标签: jquery jquery-ui iframe jquery-ui-draggable