jQuery 可拖动 IFrameFix
我对 jQuery Draggable IFrameFix 有一个小问题。 我有一个容器(如下所示),里面有一个 iframe。我在可拖动设置中打开了 iframeFix,但它没有改变任何东西。任何人遇到同样的问题或任何人可能知道如何解决这个问题?
<div class="container">
<div class="toolbar">
<div class="opt1"></div>
<div class="opt2"></div>
</div>
<iframe src="url" class="frame" frameborder="0" scrolling="no"><p>No support for iframes</p></iframe>
</div>
这是我的 JavaScript 代码。
$(".container").draggable({
snap: ".snapper_col",
containment: "#element_container",
handle: '.opt1',
snapTolerance: 20,
iframeFix: true,
cursor: "crosshair",
start: function(ev,ui){
},
drag: function(ev,ui){
},
stop: function(ev, ui){
}
});
谢谢!
I have a little problem with the jQuery Draggable IFrameFix.
I have a container (as shown below) with an iframe inside of it. I turned on the iframeFix in my draggable setup, but it doesn't change a thing. Anyone who had the same problem or anyone who might know how to solve this?
<div class="container">
<div class="toolbar">
<div class="opt1"></div>
<div class="opt2"></div>
</div>
<iframe src="url" class="frame" frameborder="0" scrolling="no"><p>No support for iframes</p></iframe>
</div>
This if my javascript code.
$(".container").draggable({
snap: ".snapper_col",
containment: "#element_container",
handle: '.opt1',
snapTolerance: 20,
iframeFix: true,
cursor: "crosshair",
start: function(ev,ui){
},
drag: function(ev,ui){
},
stop: function(ev, ui){
}
});
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
解决了。
我在 iframe 上创建了自己的叠加层,当我开始拖动时,我会显示它并在停止时隐藏它。这样 iframe 就不会干扰拖动。
Solved it.
I created my own overlay over my iframe and when I start dragging I display it and hide it when I stop. This way the iframe doensn't mess with the dragging.
是的,你可以在 iframe 上放置一个 div,我使用这个函数:
这就是
你需要研究这段代码的函数,因为我在我的项目中使用了它,以及类和其他东西,但请确保你理解这个概念。
Yes, you can put a div over the iframe, i use this function:
And this is the function
You need study this code because i use this for my project, with clases and other things, but sure you understand the concept.
下面是一些代码,用于说明 jeroenjoosen 给出的正确答案,位于 这里
CSS
HTML
Jquery
Here is some code to illustrate the correct answer given by jeroenjoosen located here
CSS
HTML
Jquery