• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 575
  • Last Modified:

Dragging when mouse on Iframe Content

Hi, I have a draggable DIV that has Iframe in its content section. The draggable popup is defined as

<div id=popupcontainer>
  <div id='popupInner'>
    <div id='popupTitleBar class=dragHandle> title </div>
    <div id='content'> <iframe src="'+ gDefaultPage +'" style="width:100%;height:100%;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" ></iframe>
     </div>
  </div>
</div>

The drag routine is defined  on the popupContianer div. The dragHandle Div is the handle clicking on which I will be dragging the entire div. the problem is when I move the mouse over the content of the frame, the popup is not moving. Once I am out of the iframe content the popup is dragged to the new position.

How do I keep the iframe moving even whenever the mouse is over the iframe content?
0
zmoidin
Asked:
zmoidin
  • 4
1 Solution
 
zmoidinAuthor Commented:
here is a sample drag-resize code. You could see in this that the iframe doesnot smoothly drag or resize according to the event. Could someone point out where I am going wrong.

While dragging the popup, if the mouse moves into the iframe content the popup doesnt moves. Also there seems to be problems wiht setting the height of the div in accordance with iframes.

could some one point me in the right direction.
dragresize2.zip
0
 
zmoidinAuthor Commented:
This is also called the sticky iframe issue.
0
 
b0lsc0ttCommented:
You could try creating a layer over the iframe.  That way the page will still have an element and focus in that area, even over the iframe.  Of course this may cause a problem if you need to work in the iframe.  If that will be the case then you might try hiding the layer until the drag starts and then have the event show it.

I haven't tried this method to see if it would work though or how well it will work.  Let me know if you have a question and I can try to provide details if you need them.

bol
0
 
zmoidinAuthor Commented:
b0lsc0tt,

your solution to create a layer seems the right way to go. Is it possible for you to provide more details on implementing this layer. I tried creating a div


<div id=popupcontainer>
  <div id='popupInner'>
    <div id='popupTitleBar class=dragHandle> title </div>
<div id='frameLayer'> </div>
    <div id='content'> <iframe src="'+ gDefaultPage +'" style="width:100%;height:100%;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" ></iframe>
     </div>
  </div>
</div>

This didnot solve the problem. I also notice that after I select the popup for dragging. When I move the mouse outside the popup the events work fine, when I move the mouse inside the iframe none of the events are recognized.

any idea why that happens ? This happens both in IE and Firefox.

thanks in advance
0
 
zmoidinAuthor Commented:
I found that the problem exists because the iframe contents are treated as a separate document than the original page. Hence the iframe events are not propogated to the main document.

Theoretically what needs to be done is on loadign the iframe, I need to assign the dragResize event handlers to the iframe mouse events. I think that will fix the problem. But I have no idea how to make synchronize the iframe events with the main document events. Can someone help?
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now