jQuery UI sortable, each sortable div contains an iFrame gets refreshed in FF3 but not in IE7

拟墨画扇 提交于 2020-01-04 03:54:19

问题


I'm using the jQuery UI Sortable on DIV which contains DIV tags. Inside of each of the sortable DIV's is an iFrame with a src= to a different site.

In IE7, sorting works as expected. If you've navigated within the iFrame, the iFrame retains the current state.

However, in FF3, when sorting stops and the iFrame is reloaded with the original url specified. This is not what I want.

I've tried using both DIV/DIVs and UL/LIs and both behave the same.


回答1:


This is a bug in FF (and apparently Safari 3.5/Win and Opera 9.5/Win): iframes reload if moved in the DOM tree. (jQuery sortable moves the node in the DOM tree when you drop it).

See https://bugzilla.mozilla.org/show_bug.cgi?id=254144.

The way I've gotten around this before is to designate some area attached to the iframes parent the "handle" for jQuery sortable to operate on. For example:

+-----------------------+
| Drag Me | iframe here |
+---------+             |
          |             |
          +-------------+

You drag the "handle", and not the actual iframe container. On Drop, you re-arrange the handles, leaving the iframe where it is in the DOM. This worked well in my case but YMMV.



来源:https://stackoverflow.com/questions/736023/jquery-ui-sortable-each-sortable-div-contains-an-iframe-gets-refreshed-in-ff3-b

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!