I have a standard scrollable content with some block elements.
I want to find out position of the div (relative to content top) and move scroll to that possiton. Is it possible? Maybe with jquery.
你可以使用 JQuery 来做这样的事情:
function scroll(element, parent){
$(parent).animate({ scrollTop: $(element).offset().top - $(parent).offset().top }, { duration: 'slow', easing: 'swing'});
}
检查演示。