Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine if scrolling is required ....

Status
Not open for further replies.

furan

Programmer
Aug 17, 2001
17
0
0
GB
All,
I am maintaining a bundle of pages which have all had an icon tagged to the bottom which redirects the user to the top of the page i.e. xxx.htm#Top. This is all well and good when the scrolling is required but it looks a bit dumb on pages with only one or two paragraphs on them. Is there a way in which I can determine if the scrollbars are active and if they are available to use (i.e scrolling is required) or should I continue to use the script i have which makes a rough guess at this dependant on the amount of page content...(not very accurate!)

Any help appreciated


Stu
 
document.body.scrollTop should tell you if there is any scrollba extended, so youcould call a funtion onLoad to check the state of scrolling.


function checkBars(){
if(document.body.scrollTop >100){
//show the 'to top' button
}
else{}
}

bj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top