Link to home
Start Free TrialLog in
Avatar of mon_pacey8
mon_pacey8

asked on

How to control the scrollbar x and y position in html using javascript or css

How to control the scrollbar x and y  position in html using javascript or css
Avatar of joebednarz
joebednarz
Flag of United States of America image

For Mozilla browsers, try this site:

http://www.xulplanet.com/references/elemref/ref_StyleProperties.html

Otherwise, I think all you can really do with scrollbars (common to all browsers) is:

scrollbar-face-color
scrollbar-arrow-color
scrollbar-base-color
scrollbar-shadow-color
scrollbar-dark-shadow-color
scrollbar-highlight-color
scrollbar-3d-light-color

Now, if you are trying to "move" the scrollbar for the entire page, I'd try a different approach... I'd create a DIV around the area you want to scroll (whole page, use a DIV that is x-pixels wide, etc) and set the "overflow: scroll;" on the DIV.
Avatar of mon_pacey8
mon_pacey8

ASKER

Hi joebednarz, can you give me some examples using that DIV to move the scrollbar. Im still new in web programming. thanks
ASKER CERTIFIED SOLUTION
Avatar of joebednarz
joebednarz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi joebednarz, how about  if I wanted to remove some upper part of the page like from your example I dont want to see the 1 to 4. Only the 5 to 10 as your example above
So, you want to still have the HTML print out all values, but only show the last 5... essentially hiding the first four values?

Well, I know you can set "overflow: none" and it will simply display what it can in the scrolling DIV... which portion it shows, I'm not really sure.  You could at that point, use some javascript to make the current position the bottom of the DIV... kind of a forced scroll...

Hope I understood your question correctly...