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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrollbars, shouldn't be there... 1

Status
Not open for further replies.

Isadore

Technical User
Joined
Feb 3, 2002
Messages
2,167
Location
US
I had a couple of questions answered here at the Java forum over the weekend, great stuff, very impressed.

But I have one more question. I am implimenting a java routine to elminate scroll bars, but I have to ask, why ar they there in the first place?

My web page is 773 x 555 and shouldn't call for scrollbars, but there they are. What could possibly be forcing the scrollbars to appear when they are not needed?

Thanks!
 
The reason for the question is that even though I am elminating the scrollbars using java at load time, the page "jumps" to a new position which the client can see, and makes the whole opening operation jumpy and eratic.

Thanks.
 
I dont know about any other browsers but internet explorer always displays the vertical scrollbar, unless you tell it not to. It is not a size based thing.

Robert Carpenter
--------------------
"Isn't it funny how you are perfectly content with being alone until nobody else is?"
--------------------
robert@convertingchaos.com
convertingchaos.com
 
Robert - that may be true, but I get both scrollbars up; the problem is not have the scrollbars show up at all. When you set the body style attribute using javascript, during the page load to the client, the scroll bars appear, both of them, and then when they are removed, finally, the page "jumps" to the right, and is not a very nice opening of the page.

I could live with the vertical scroll bar showing but it is a nuisance if it is not needed. The problem with all of this is that if a user has 800 resolution, they will need scrollbars, and if >800 they will not. The simple javaroutine posted on a related thread does this rather well - but if the scroll bars never appeared during client rendering in the first place, all would be well, the page would not "jump".

Can I turn the scrollbars off earlier? instead of:

window.onload = function() {
if (screen.width > 801)
document.body.style.overflow = "hidden";
}

...which works fine, perhaps I should have something like:

<body ... style.overflow=&quot;hidden&quot;;'>...</body>

..and perhaps in the javaroutine:

window.onload = function() {
if (screen.width > 801)
document.body.style.overflow = &quot;hidden&quot;;
else
document.body.style.overflow = &quot;visible&quot;;
}

would this be the correct syntax?
 
Or, alternatively, do you think server side scripting is an option here?
 
Does <body scroll=&quot;no&quot;> not work?

Adam
while(ignorance==true){perpetuate(violence,fear,hatred);life=life-1};
 
Adam --

There is a reason that the exception makes the rule and that genius is simple. scroll=&quot;no&quot; solved everthing.
 
So the solution is:

<body ...scroll=&quot;no&quot; ...></body>

and in the onload of the form:

window.onload = function() {
if (screen.width < 801)
document.body.style.scroll=&quot;yes&quot;
}

...and that should do it - no appearence of the scroll bars at all until they are needed.

Thanks for all the help.
 
i'm pretty sure body scroll=&quot;no&quot; is IE only

if you're always getting a horizontal scrollbar in IE, i think it's related to a CSS margin or padding setting for an element, or if you have some element set to width:100%;

IE doesn't handle all CSS properly



=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
jeff --

thanks a lot, great input. I'll double check the CSS materials. You guys are very helpful, very impressed with the help, thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top