alternative for Jquery scrollto

Go To StackoverFlow.com

-1

I'm searching a way to have a horizontal scroller on hyperlinks and I have been taking a look on the scrollto plugin but as it seems is really outdated. Is it possible to achive the same results just with simple jquery?

2012-04-04 18:06
by lgt
Please be more descriptive and show some code. What is "horizontal scroller on hyperlinks" supposed to do exactly? Click a link and scroll the page sideways - Sparky 2012-04-04 18:21


0

$('#divToScroll').animate({'scrollTop': '20'}); // scroll to 20px

Or if you want relative scrolling:

$('#divToScroll').animate({'scrollTop': '+=20'}); // scroll to 20px below current position

Example fiddle: http://jsfiddle.net/zq4a8/

Example fiddle for horizontal scroller: http://jsfiddle.net/rGcWm/4/

$('#scroller').click(function() { $('#outer').animate({'scrollLeft': '+=20'}); });
$('#scroller_to').click(function() { $('#outer').animate({'scrollLeft': '20'}); });​
2012-04-04 18:08
by Andreas Wong
can you give me an example - lgt 2012-04-04 18:17
show me your markup and I'll lead you o - Andreas Wong 2012-04-04 18:18
@lgt http://jsfiddle.net/zq4a8 - Andreas Wong 2012-04-04 18:20
scrollTop is vertical scrolling (up/down) the page. The OP said he wants "horizontal scroller" (left/right, I assume) - Sparky 2012-04-04 18:21
@Sparky672 yeah just realised :s http://jsfiddle.net/rGcWm/4 - Andreas Wong 2012-04-04 18:22
Right. And I'm checking now if animate can handle something like scrollLeft and scrollRigh - lgt 2012-04-04 18:23
@lgt edited my answe - Andreas Wong 2012-04-04 18:23
Ads