anna wrote:
How to tell if a horizontal scrollbar is present? I only want to use
scrollTo if horizontal scrollbar is present.
window.scrollba rs.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 showscrollfeatu res() {
var msg = 'clientHeight ' + window.document .body.clientHei ght + '\n';
msg += 'clientWidth ' + window.document .body.clientWid th + '\n';
msg += 'offsetHeight ' + window.document .body.offsetHei ght + '\n';
msg += 'offsetWidth ' + window.document .body.offsetWid th + '\n';
msg += 'scrollHeight ' + window.document .body.scrollHei ght + '\n';
msg += 'scrollWidth ' + window.document .body.scrollWid th + '\n';
msg += 'scrollLeft ' + window.document .body.scrollLef t + '\n';
msg += 'scrollTop ' + window.document .body.scrollTop + '\n';
alert(msg);
}
function scrollbarcheck( ) {
var scrolling;
if ((window.docume nt.body.scrollH eight >
window.document .body.clientHei ght) ||
(window.documen t.body.scrollWi dth >
window.document .body.clientWid th))
scrolling='true ';
else
scrolling='fals e';
alert('scrollin g='+scrolling);
}
Mike