REA_ANDREW
asked on
offsetY issue
http://www.nwcms.co.uk/default.aspx
Hi,
On that page I have shown an example of my problem. The construct is originally 2 div. The outer container which you see the border and an inner DIV. The outer container is overflow:hidden. The inner Div is 6000px high and 1000px wide. now to debug this if you mouse over it anywhere, the right hand textbox should show the offsetY. now it does only I need it to always be the offsetY of the InnerDIV that large one. It only shows the offsetY of the large div when you mose is between the brick sections, so to visualise the CEMEMENT lol. How can I get the offsetY to always remained focused to the innerDIV and not lose it once over a nested element
Thanks in advance
Andrew
Hi,
On that page I have shown an example of my problem. The construct is originally 2 div. The outer container which you see the border and an inner DIV. The outer container is overflow:hidden. The inner Div is 6000px high and 1000px wide. now to debug this if you mouse over it anywhere, the right hand textbox should show the offsetY. now it does only I need it to always be the offsetY of the InnerDIV that large one. It only shows the offsetY of the large div when you mose is between the brick sections, so to visualise the CEMEMENT lol. How can I get the offsetY to always remained focused to the innerDIV and not lose it once over a nested element
Thanks in advance
Andrew
Does this help:
function MoveIt(e)
{
var e = e || window.event;
var theDiv = document.getElementById("I nnerContai ner");
var xOff = theDiv.offsetLeft;
var yOff = theDiv.offsetTop;
document.getElementById("T extBox1"). value = e.clientX - xOff // e.offsetX;
document.getElementById("T extBox2"). value = e.clientY - yOff // e.offsetY;
}
function MoveIt(e)
{
var e = e || window.event;
var theDiv = document.getElementById("I
var xOff = theDiv.offsetLeft;
var yOff = theDiv.offsetTop;
document.getElementById("T
document.getElementById("T
}
Or this version:
function MoveIt(e){
var e = e || window.event;
var theDiv = (e.target)?e.target:e.srcE lement;
var xOff = 0;
var yOff = 0;
if(theDiv.parentNode.id==" InnerConta iner"){
var xOff = theDiv.offsetLeft;
var yOff = theDiv.offsetTop;
}
document.getElementById("T extBox1"). value = xOff + e.offsetX;
document.getElementById("T extBox2"). value = yOff + e.offsetY;
}
function MoveIt(e){
var e = e || window.event;
var theDiv = (e.target)?e.target:e.srcE
var xOff = 0;
var yOff = 0;
if(theDiv.parentNode.id=="
var xOff = theDiv.offsetLeft;
var yOff = theDiv.offsetTop;
}
document.getElementById("T
document.getElementById("T
}
And for FF?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
great :)
ASKER
haha perfect. Thankyou very much!!
Andrew
Andrew
document.getElementById("T
document.getElementById("T