Link to home
Start Free TrialLog in
Avatar of zmoidin
zmoidinFlag for United States of America

asked on

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?
Avatar of zmoidin
zmoidin
Flag of United States of America image

ASKER

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
Avatar of zmoidin

ASKER

This is also called the sticky iframe issue.
Avatar of b0lsc0tt
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
Avatar of zmoidin

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of zmoidin
zmoidin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial