anna wrote:
How to tell if a horizontal scrollbar is present? I only want to use
scrollTo if horizontal scrollbar is present.
window.scrollbars.visibility doesn't specify which scrollbar is
present, so it gives a false result if there is vertical scrollbar but
not horizontal scrollbar.
TIA,
Anna
You could give this a try, check for scrollWidth > clientWidth.
It works for my IE6, Netscape 7.1, Firefox 0.8.
function showscrollfeatures() {
var msg = 'clientHeight ' + window.document.body.clientHeight + '\n';
msg += 'clientWidth ' + window.document.body.clientWidth + '\n';
msg += 'offsetHeight ' + window.document.body.offsetHeight + '\n';
msg += 'offsetWidth ' + window.document.body.offsetWidth + '\n';
msg += 'scrollHeight ' + window.document.body.scrollHeight + '\n';
msg += 'scrollWidth ' + window.document.body.scrollWidth + '\n';
msg += 'scrollLeft ' + window.document.body.scrollLeft + '\n';
msg += 'scrollTop ' + window.document.body.scrollTop + '\n';
alert(msg);
}
function scrollbarcheck() {
var scrolling;
if ((window.document.body.scrollHeight >
window.document.body.clientHeight) ||
(window.document.body.scrollWidth >
window.document.body.clientWidth))
scrolling='true';
else
scrolling='false';
alert('scrolling='+scrolling);
}
Mike