Creating a jQuery UI sortable in an iframe

后端 未结 4 964
别那么骄傲
别那么骄傲 2020-12-30 08:22

On a page I have an iframe. In this iframe is a collection of items that I need to be sortable. All of the Javascript is being run on the parent page. I can access the list

4条回答
  •  爱一瞬间的悲伤
    2020-12-30 09:04

    I don't know why your code isn't working. Looks like it should be.

    That said, here are two alternative ways to implement this feature:

    1. If you can modify the iframe

      Move your JavaScript from the parent document into iframe-test.html. This may be the cleanest way because it couples the JavaScript with the elements its actually executing on.

      http://dl.dropbox.com/u/3287783/snippets/rarayiframe/sortable-test.html

    2. If you only control the parent document

      Use the jQuery .load() method to fetch the content instead of an HTML iframe.

      http://dl.dropbox.com/u/3287783/snippets/rarayiframe2/sortable-test.html

提交回复
热议问题