[Javascript] Monitor an offsetHeight value
Guillaume
javascript at webdesignofficina.com
Mon Jan 15 08:52:23 CST 2007
Stefan, Paul, and all others who haven't replied yet...
Here's my function below re-aranged according to your replies...
I still don't understand why, when checkOptSli() is called, I always get the else statement... Not being able
to compare an initial value to a listened one...
Can someone please light up the path a bit...
Regards,
Guillaume.
function checkOptSli() { // This is fired when a user clicks a link
var sto2 = 0;
sto2ID = setTimeout("checkOptJ();", 2000);
}
function checkOptJ() {
var optsh0 = checkOptK;
optsh3 = optsh0;// Initial value (offsetHeight) of element
var optsh1 = 0;
var optsh1ID = setTimeout("checkOptL();", 2000);
optsh4 = optsh1ID;// Value to be listened to and compared to the previous one above
if ( optsh4 > optsh3 ) {
alert( "things have moved" );
}
else {
alert( "quiet" );
}
}
function checkOptK(){ // Fired on the onload so we have a value as starting point
var opts1 = document.getElementById("options");
moveBy1 = opts1.offsetHeight;
posTn3 = 0 - moveBy1;
parseInt( posTn3 );
return posTn3;
}
function checkOptL(){ // Looped inside a setTimeout to see if this value is changing...
// And compare it inside the checkOptJ()function to the checkOptK()resulting value
var opts2 = document.getElementById("options");
moveBy2 = opts2.offsetHeight;
posTn4 = 0 - moveBy2;
parseInt( posTn4 );
return posTn4;
}
More information about the Javascript
mailing list