P
Peter Fastré
Hello
I want to display a link on the bottom of a webpage to go to the top,
but only if the user has to scroll down. If there's a small page, this
link has no use.
I'm using the following code (in the body onload)
var wdb = window.document.body;
var scrolling;
if (wdb.scrollHeight > wdb.clientHeight) {
//alert('Scrolling=True');
document.getElementById('img_totop').style.visibility
= 'visible';
}
else {
//alert('Scrolling=False');
document.getElementById('img_totop').style.visibility
= 'hidden';
}
It works on Internet Explorer, scrollHeight is bigger than clientHeight
with a long page.
But not in firefox, scrollHeight = clientHeight in all cases.
What can I do about it?
regards
Peter
I want to display a link on the bottom of a webpage to go to the top,
but only if the user has to scroll down. If there's a small page, this
link has no use.
I'm using the following code (in the body onload)
var wdb = window.document.body;
var scrolling;
if (wdb.scrollHeight > wdb.clientHeight) {
//alert('Scrolling=True');
document.getElementById('img_totop').style.visibility
= 'visible';
}
else {
//alert('Scrolling=False');
document.getElementById('img_totop').style.visibility
= 'hidden';
}
It works on Internet Explorer, scrollHeight is bigger than clientHeight
with a long page.
But not in firefox, scrollHeight = clientHeight in all cases.
What can I do about it?
regards
Peter