Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Does anyone know if you can apply the javascript function scrollBy(x,y) to a div or image instead of window.scrollBy(x,y)? If so then how? I tried idName.scrollby and declaring an element as a variable and then using varName.scrollBy but no luck. I can't find anything on the web... Any help?
Posted

1 solution

Try looking at: This[^]

I tried with one, but you can try with all, changing <p> tags to <div> tags.

Also, bookmark the W3C schools site for future reference.


 
Share this answer
 
v2
Comments
mrDivan 27-Sep-13 8:30am    
Im not looking for this solution I am trying to scroll a div only not the entire page but thank you anyway
W Balboos, GHB 27-Sep-13 11:52am    
Fair enough. Have you considered using an iframe instead of a div? It would be an independent window and could then be subject to its own scrollBy(). Admittedly, I've not tried this - but it seems like it would give you the control you need.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900