开发者

How to apply drag and drop in iframe from outside HTML?

开发者 https://www.devze.com 2023-03-21 03:25 出处:网络
Assume that I have following HTML file: ** main.html ** <html> <body> <ul> <li>Element to drag</li>

Assume that I have following HTML file:

** main.html **

<html>
<body>
<ul>
<li>Element to drag</li>
</ul>开发者_如何学C

<iframe src="demo.html">
</iframe>
</body>
</html>

demo.html (iframe code)

<body class="iframe">

</body>

I'm using jquery UI for drag and drop (Link) And assume that all javascript files are included in main.html and demo.html

Any help would be great helpful !!! Thanks


I had the same problem and manage to do it this way.

Consider the draggable element in your main file normally and refer to the iframe droppable elements with

$( 'your-iframe' ).contents().find( 'elments-you-want-droppable' ).droppable({

    // droppable settings here as normal

});
0

精彩评论

暂无评论...
验证码 换一张
取 消