Back To Start Of Archive
Taken From The Forum: Anything Goes
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:28
resize IE
Poster: Schmoo
Dated: Wednesday September 26 2007 - 11:34:09 BST
Hi,
When clicking the menu on my page the whole page is shown. But then this fuction is called and suddenly everything below a certain point disappears! It works fine in FF. Does it have anything to do with document.documentElement.clientHeight?
Code:
var origWidth = document.documentElement.clientWidth;
var origHeight = document.documentElement.clientHeight;
var dropMenuVisible = false;
function resizeHandler() {
if (ie4) {
var myWidth=0;
var myHeight=0;
var i;
var menues = getElementsByName_iefix("div", "undermeny"); // getElementsByName doesn't work in IE
for (i=0; i < menues.length; i++) {
if (document.getElementById(menues[i].id).style.visibility == "visible") {
dropMenuVisible = true;
}
else
dropMenuVisible = false;
if ( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
}
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
}
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
if (myWidth != origWidth || myHeight != origHeight) {
// ie6
origWidth = document.documentElement.clientWidth;
origHeight = document.documentElement.clientHeight;
}
else {
// ...statements to execute on a resize...
// window.location.reload(); not necessary
if (dropMenuVisible) {
document.getElementById(menues[i].id).style.visibility = "hidden";
document.getElementById(menues[i].id).style.visibility = "visible"; // In correct position
}
}
// onResize=location.reload()
}
}
}
window.onresize = resizeHandler;
var origHeight = document.documentElement.clientHeight;
var dropMenuVisible = false;
function resizeHandler() {
if (ie4) {
var myWidth=0;
var myHeight=0;
var i;
var menues = getElementsByName_iefix("div", "undermeny"); // getElementsByName doesn't work in IE
for (i=0; i < menues.length; i++) {
if (document.getElementById(menues[i].id).style.visibility == "visible") {
dropMenuVisible = true;
}
else
dropMenuVisible = false;
if ( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
}
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
}
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
if (myWidth != origWidth || myHeight != origHeight) {
// ie6
origWidth = document.documentElement.clientWidth;
origHeight = document.documentElement.clientHeight;
}
else {
// ...statements to execute on a resize...
// window.location.reload(); not necessary
if (dropMenuVisible) {
document.getElementById(menues[i].id).style.visibility = "hidden";
document.getElementById(menues[i].id).style.visibility = "visible"; // In correct position
}
}
// onResize=location.reload()
}
}
}
window.onresize = resizeHandler;