jQuery and iframes and weird positioning: is there a workaround?

前端 未结 2 644
北海茫月
北海茫月 2020-12-21 00:56

I\'ve got a draggable thing outside an iframe, and a droppable target inside it. Here I\'ve shown the iframe as containing a snippet of the HTML that is loaded by its src at

相关标签:
2条回答
  • 2020-12-21 00:58

    You're trying to access the parent element from within the child iframe. I haven't personally tested it, but try to set context for your jquery selector. Otherwise, it'll look only inside the current iFrame.

    $('#draggables img', parent).draggable();
    
    0 讨论(0)
  • 2020-12-21 01:19

    It was asked a long ago, but digging SO I found a GIST where people solved this problem by overwriting the default behavior of $.ui.ddmanager.prepareOffsets.

    You can find the working code here: https://gist.github.com/gujiman/581a3cee1dbf4beafccb

    0 讨论(0)
提交回复
热议问题