kylebellamy
Programmer
Backstory: I have a script running that shows and hides DIVs which I will paste in just a second. I've discovered that the process is slightly flawed in that the positioning of the DIVs is based off strange coordinates.
At first, I was using CSS inline to position them with Margins but if any content changed above the triggers on the page, the DIVs would then have to be repositioned which is a pain.
As far as inline CSS is concerned, I've tried using left and top tags set to auto with positioning set to absolute but they have no effect.
So, I want to find a way to modify the following code so that the position is from the trigger only. Then I can use the CSS positioning to place it where I like and make my days sooooooo much better.
Oh and as an afterthought, I can't direct you to the page to look at as it is an internal net and I would violate all sorts of security sops. Sorry, it would be so much easier if I could.
At first, I was using CSS inline to position them with Margins but if any content changed above the triggers on the page, the DIVs would then have to be repositioned which is a pain.
As far as inline CSS is concerned, I've tried using left and top tags set to auto with positioning set to absolute but they have no effect.
So, I want to find a way to modify the following code so that the position is from the trigger only. Then I can use the CSS positioning to place it where I like and make my days sooooooo much better.
Code:
function popUpDiv(evt, currElem) {
popUpWin = eval("document.all." + currElem + ".style");
popUpWin.top = parseInt(evt.y);
popUpWin.left = parseInt(evt.x);
popUpWin.visibility = "visible";
popUpWin.status = "";
}
function popDownDiv(evt,currElem) {
eval("document.all." + currElem + ".style").visibility = "hidden";
}
var iDelay = 500
var sDisplayTimer = null, oLastItem
function getRealPos(i,which) {
iPos = 0
while (i!=null) {
iPos += i["offset" + which]
i = i.offsetParent
}
return iPos
}
function showDetails(sDest,itop,ileft) {
if (document.all) {
var i = event.srcElement
stopTimer()
dest = document.all[sDest]
if ((oLastItem!=null) && (oLastItem!=dest))
hideItem()
if (dest) {
if (ileft)
dest.style.pixelLeft = ileft
else
dest.style.pixelLeft = getRealPos(i,"Left") + i.offsetWidth + 160
if (itop)
dest.style.pixelTop = itop
else
dest.style.pixelTop = getRealPos(i,"Top") +200
dest.style.display = "block"
}
oLastItem = dest
}
}
function stopTimer() {
clearTimeout(sDisplayTimer)
}
function startTimer(el) {
if (!el.contains(event.toElement)) {
stopTimer()
sDisplayTimer = setTimeout("hideItem()",iDelay)
}
}
function hideItem() {
if (oLastItem)
oLastItem.style.display="none"
}
Oh and as an afterthought, I can't direct you to the page to look at as it is an internal net and I would violate all sorts of security sops. Sorry, it would be so much easier if I could.