Faking a Scrollbar width
I have a overflow-x: scroll div, with some content in it. However, the content is supposed to be pretty large, so I would like to ajax load it in dependent upon how far the user has scrolled. But I can't come up with a good way to make the scrollbar appear appear like there is content further away, when the content is yet to be displayed.
My solutions so far have revolved around creating a fake "padding" div on either side with its wid开发者_JS百科th set dependent on the scrollbar's position. However, I find that upon the updating of these widths, the scroll bar gets quite jumpy.
What is a good way to do this?
Live demo: http://jsfiddle.net/UDnjC/
You just make an inner wrapper and use min-width
and/or min-height
to force the scroll-bar on the outer wrapper.
Demo with horizontal scrolling: http://jsfiddle.net/UDnjC/1/
Alternative solution: http://jsfiddle.net/UDnjC/2/
The way that I would do this sort of thing, would be have the actual content div nested inside the div with the scrollbar, with that inner div having some large pre-set width.
精彩评论