[Javascript] Monitor an offsetHeight value
Guillaume
javascript at webdesignofficina.com
Thu Jan 11 10:59:12 CST 2007
Hi all,
I'm trying to build a function that would monitor an offsetHeight value,
to test if this value is changing from it's initial value to something
smaller or bigger when a user plays with the page: either resize the
browser window or the text size.
I have already come across scripts that would monitor if the font size
has changed.
In my situation I have also to monitor an existing element of the layout
height.
So I have two values:
el1 = elem.offsetHeight; >> That's the value fired when the page is
first loaded
el2 = elem.offsetheight >> That's the same value but in a setTimeout,
that needs to be checked
Does anyone have any idea on how to achieve this or ressources to point to.
Thanks !
Here's my unlucky attempt below:
function checkOptJ(){
var opts1 = document.getElementById("options");
moveBy1 = opts1.offsetHeight;// Initial value
function checkOptK(){
opts44 = document.getElementById("options");
moveBy22 = opts44.offsetHeight;// Value to be checked
}
setTimeout("checkOptK();", 2000);
if ( moveBy1 !== moveBy22) {
alert( "things have moved" );
}
}
More information about the Javascript
mailing list