Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

andyjamesnelson

macrumors 6502
Original poster
Aug 24, 2003
286
0
Jacob's house
Hey

I'm working on a page thats often going to go from having very little content to lots of content in the same window.

I was wondering if there is a good way to stop the scroll bar jumping the page left a bit?

Andy
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,852
9
USA
The most straight forward approach would be to have the scroll bar present always.

Code:
overflow-y: scroll;
 

andyjamesnelson

macrumors 6502
Original poster
Aug 24, 2003
286
0
Jacob's house
That seems to give one a white bar in which the scroll bar would sit when there isn't enough content on the page.

I've found that height:101% on html seems to work pretty well.

Not sure if there are any bad side effects.

Andy
 

Me1000

macrumors 68000
Jul 15, 2006
1,794
4
That seems to give one a white bar in which the scroll bar would sit when there isn't enough content on the page.

I've found that height:101% on html seems to work pretty well.

Not sure if there are any bad side effects.

Andy

having a very small sliver of scroll bar no matter how tall your window is can be very annoying to users...

I know it annoys me...



angelwatt's solution is the best...
 

andyjamesnelson

macrumors 6502
Original poster
Aug 24, 2003
286
0
Jacob's house
Sure I get that and I also find it annoying.

I am just not sure how to use anglewatts suggestion?

I used it on the html element and it gave an empty white strip which didnt look good either or a least didn't look any better then always having the blue scroll bar/

Is there no way to achieve the effect without either?

Andy
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,852
9
USA
I am just not sure how to us anglewatt's suggestion?

Well, you never gave any code, so I can't tell you how to apply it. If you want another solution you can use,

Code:
overflow: hidden;
height: some height;
But you may not like the result. There'll be no scroll bar, but some content may be inaccessible. You have to realize these scroll bars exist for a reason, and trying to modify how they behave will only result in ruining the user experience.
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
Hey

I'm working on a page thats often going to go from having very little content to lots of content in the same window.

I was wondering if there is a good way to stop the scroll bar jumping the page left a bit?

Andy

Consider a design change -- i.e. displaying a window popup with the updated content, but a REALLY cool one...

For example use JQuery with the Facebook plugin and add either a link or an onLoad event to trigger a cool looking 3D/shadowed popup window which contains the new content in the form of an .html file. You can then add in the CSS there to display the scroll bars when necessary - the plugin automatically sizes the window for you. This is actually quite nice looking compared to the browser window scroll bars. The window includes "Close" icon, too. Just a suggestion as to an alternative approach.

-jim
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.