0
$("#wrapper").scrollTop($("#wrapper").scrollTop()+$("div.element.active").position().top);    
})

http://jsfiddle.net/yuFk5/250/

This script includes a workaround to allow scrolling with overflow hidden, but I am getting confused about how to implement animate into this to give the animation a duration.

user3653087
  • 70
  • 1
  • 8

1 Answers1

3

Based off the code in your jsFiddle

$( document ).ready(function() {
    $("#foo").click(function() {
        $("#wrapper").animate({'scrollTop': $("#wrapper").scrollTop()+$("div.element.active").position().top}, 400);    
    })
});
Blake Plumb
  • 6,779
  • 3
  • 33
  • 54