Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Drag and Drop across Windows

Posted on 2013-02-01
Medium Priority
Last Modified: 2013-02-01
I have a page that loads and then that page's JavaScript opens a popup window that will become a gallery. The user will upload images, using JavaScript and PHP that is part of the popup gallery window, and these uploaded  images will be displayed in the gallery window that we popped up

Once several images have been uploaded and displayed in the gallery window I would like to drag and drop them into the primary window. Actually I'd like to leave the image in the gallery and just drag a ghost image across and drop it in the main window, so we end with the image in both windows.

This seems a bit tricky since the main widow and the popup gallery window are different JavaScript execution contexts.  How can I implement a jQuery (or YUI) Drag and Drop that works from the popup window to the main window?

Thanks for any ideas.
Question by:steva
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 11

Accepted Solution

mcnute earned 2000 total points
ID: 38843309
You cannot do this through windows, but you should consider modals which imitates the behavior of your popup but is in the same dom as your main window.

Consider a jquery dialogue

Author Comment

ID: 38844768
Hmmmm.  Ok.  I've used jQuery dialogs before.  Basically they're just a div that gets its display mode  set to none or to  block and they're certainly in the same DOM as everything else in the viewport so the Drag and Drop should work fine.  

The dialog would have to have a form with an input type:file to get the images to upload, but that shouldn't be a problem.

I was following the path TinyMCE took with their Rich-text editor.  When you click the button  in the TinyMCE toolbar to insert an image a new popup window is opened that has  a form to get the image. The image is then transferred into the RTE window by calling a function back in the RTE window's  javascript with something like

Open in new window

But this inserts the image wherever the cursor is in the RTE window and I want to be able to drop it anywhere, so I wanted to employ Drag and Drop.

I'm wondering now why TinyMCE went to all the trouble of opening a new window, instead of using a dialog.

I gave you the points for your suggestion.  If you happen to have any thoughts on the above I'd  be interested.


Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question