For number one, change this:
Code:
function overlay(curobj, subobj){
if (document.getElementById){
var subobj=document.getElementById(subobj)
subobj.style.left=getposOffset(curobj, "left")+"px"
subobj.style.top=getposOffset(curobj, "top")+"px"
subobj.style.display="block"
return false
}
else
return true
}
to this:
Code:
function overlay(curobj, subobj){
if (document.getElementById){
var overlays=document.getElementsByTagName('div')
for (var i_tem = 0; i_tem < overlays.length; i_tem++)
if (overlays[i_tem].id.indexOf('subcontent')!==-1)
overlays[i_tem].style.display="none"
var subobj=document.getElementById(subobj)
subobj.style.left=getposOffset(curobj, "left")+"px"
subobj.style.top=getposOffset(curobj, "top")+"px"
subobj.style.display="block"
return false
}
else
return true
}
For number two, there are various methods to do something like this but, all that I have seen suffer from the possibility that the window will be limited in two or three dimensions rather than the expected one. This gives rise to all sorts of weird effects. A better approach would be to keep the size of the overlays reasonable and to keep their trigger elements high enough on the page that a reasonable window size will accommodate their full visibility. If you are trying to make this script into a menu or tooltip, don't. Use a menu or tooltip script for that.
Bookmarks