Skip to content

Instantly share code, notes, and snippets.

@etozzato
Created April 1, 2010 17:53
Show Gist options
  • Select an option

  • Save etozzato/352140 to your computer and use it in GitHub Desktop.

Select an option

Save etozzato/352140 to your computer and use it in GitHub Desktop.
function scroll(direction) {
var newsHeight = ($('#home_news_list').height());
var newsContainerHeight = 190;
if (direction == "up"){
topVal += increment;
if (topVal > 0){
topVal = 0;
var stop = true;
}
}
else {
topVal -= increment;
if (topVal + newsHeight < newsContainerHeight) {
var stop = true;
}
}
if (!stop){
$('#home_news_list').animate({'top': topVal + 'px'},5);
scrolldelay = setTimeout('scroll(\''+direction+'\')',5); // scrolls every 5ms
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment