Move scrollable contents relatively with jQuery

I have a container with scrollable contents, and I need to move the position of the scroll relatively to its current position, say 20 pixels downwards. I'd like to use ScrollTo plugin, alternatively the scrollTop() jQuery function.

So if I run the desired command again and again, the container scroll is supposed to continue moving until reaching the end. Pseudo-code:

$(myContainer).scrollTo( { delta: '+20px' } );

Answers


scrollTop should do it:

$('#myContainer').scrollTop($('#myContainer').scrollTop() + delta);

try it on jsfiddle


Need Your Help

Webservices with two different context roots in one EAR - JBoss 6.1

java web-services jboss java-ee-6 jboss6.x

Is it possible to deploy two webservices with different context roots? Each webservice is located in war. Wars and other libs are packed to ear. I'm trying something like that:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.