1

On my CMS I have a list of thumbnails (Sortable). The thumbnails work great and now I'm writing a plug-in to drag-them to a tinyMCE window.

As the tinyMCE window has an iFrame it doesn't work that well.

jQuery has an option for Draggables called iframeFix that works exactly as I need. However that list must be a Sortables. I've looked quite extensively on Google and found no-one with my requirements. Has anyone here on StackOverflow done it?

Apply the iframeFix to a Sortables?

If not... I'm on my way to a jQuery plug-in.

Thank you in advance!

3
  • I've done it. You need to have a DIV on top of the iFrame to let the Draggable/Sortable flow without problems. So I used jQuery to create a DIV right on top of the iframe. Then it show's it when you grab the element and destroys it when you drop it. Works like a charm. If anyone is in need of something like that let me know.
    – Frankie
    Commented Oct 21, 2009 at 17:08
  • Not sure what you mean by 'on top of the iframe'? Can you post some code?
    – Andy Baker
    Commented Feb 3, 2010 at 8:21
  • @andybak Are you having a similar problem? TinyMCE runs in an iFrame... when you drag elements into the iFrame area the mouse sort of stops on the iFrame boundaries for a moment and then goes on. But on the user side makes the interface sluggish. The solution is to position a DIV on top of the iFrame as soon as you drag (slightly larger tough) and you can then drag at will. After you drop remove the DIV previous to any action and your ready to go!
    – Frankie
    Commented Feb 3, 2010 at 17:36

2 Answers 2

1

I've done it.

You need to have a DIV on top of the iFrame to let the Draggable/Sortable flow without problems. So I used jQuery to create a DIV right on top of the iframe. Then it show's it when you grab the element and destroys it when you drop it. Works like a charm. If anyone is in need of something like that let me know.

update (by popular request):

On my specific scenario I use the following DIV:

<div id="iframeDivFixer" class="ui-draggable-iframeFix" style="background-color: rgb(255, 255, 255); display: none; width: 665px; height: 665px; position: absolute; opacity: 0.001; z-index: 1000; left: 362px; top: 290px; background-position: initial initial; background-repeat: initial initial;"></div>

And, as soon as I grab the thumbnail javascript is used to set the display property to block. The process is reversed when you release the dragabble.

8
  • 1
    Can i make the editor droppable with this logic? can you share your code
    – user782240
    Commented Jun 29, 2011 at 13:09
  • Yes, this would be a great place to actually show the answer. Commented Feb 6, 2013 at 0:04
  • @ChristianZiebarth, made the DIV available as requested.
    – Frankie
    Commented Feb 11, 2013 at 15:18
  • But when you say "on top" of the IFRAME do you mean "comes before the IFRAME in the code?" Commented Feb 11, 2013 at 19:12
  • @ChristianZiebarth, no I'm talking about z-index
    – Frankie
    Commented Feb 11, 2013 at 19:20
0

A seriously old question here, but there's another way to do it using css - pointer-events:none; which is supported on all the currently supported browsers (IE11 and above - caniuse.com)

$("#sortable").sortable({
    start: function() {
        $("iframe").css("pointer-events", "none");
    },
    stop: function() {
        $("iframe").css("pointer-events", "");
    },
});

Not the answer you're looking for? Browse other questions tagged or ask your own question.