Skip to content

Instantly share code, notes, and snippets.

@jdcauley
Created November 17, 2014 18:53
Show Gist options
  • Save jdcauley/0701da3b954ac7a600c2 to your computer and use it in GitHub Desktop.
Save jdcauley/0701da3b954ac7a600c2 to your computer and use it in GitHub Desktop.
Match the secondar list scroll to main list
function articleMenuScroll(direction, target){
var liHeight = 0;
$('#sidebar-posts li').each(function(index) {
if($(this).attr('data-id') === target.attr('data-id')){
return false;
} else {
liHeight = liHeight + ($(this).height() + 20);
}
});
if(direction === 'down'){
$('.intro').scrollTop(liHeight);
}
if(direction === 'up'){
$('.intro').scrollTop('-' + liHeight);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment