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

x
?
Solved

Dragging when mouse on  Iframe Content

Posted on 2008-06-23
5
Medium Priority
?
564 Views
Last Modified: 2012-06-21
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
Comment
Question by:zmoidin
[X]
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
  • 4
5 Comments
 

Author Comment

by:zmoidin
ID: 21850688
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
 

Author Comment

by:zmoidin
ID: 21859648
This is also called the sticky iframe issue.
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 21871822
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
 

Author Comment

by:zmoidin
ID: 21878768
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
 

Accepted Solution

by:
zmoidin earned 0 total points
ID: 21878859
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Suggested Courses

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