The context of the problem is related to an application which is single-page Ajax application. The layout of the page consists of three different panels (iframes) as follows:
_________________________________________________
| |
| Frame A | Frame C
|__________________|
| |
| Frame B |
| |
| |
| |
| |
| |
| |
| |
The problem is with the context menu (right-click menu) in Frame C. The position of the context menu is not perfectly positioned with the mouse click. Particularly, if you drag and increase the size of the Frame C window.
Code snippet:
var rightedge = parent.frames["FrameC"].frameElement.clientWidth-event.clientX;
var bottomedge = parent.frames["FrameC"].frameElement.clientHeight-event.clientY;
if (rightedge < document.getElementById('Menu').offsetWidth)
menuCoorX = parent.frames["FrameC"].frameElement.scrollLeft + event.clientX - document.getElementById('Menu').offsetWidth;
else
menuCoorX = parent.frames["FrameC"].frameElement.scrollLeft + event.clientX;
if (bottomedge < document.getElementById('Menu').offsetHeight)
menuCoorY = parent.frames["FrameC"].frameElement.scrollTop + event.clientY - document.getElementById('Menu').offsetHeight;
else
menuCoorY = parent.frames["FrameC"].frameEl开发者_开发技巧ement.scrollTop + event.clientY;
Currently, we need it to work only for IE (7 and 8).
Please, help! Thanks.
精彩评论