jQuery对话框滚动到对话框中的元素
我有以下问题:
我用jQuery UI打开一个对话框。 此对话框包含大量内容,无法一次显示。
是否可以滚动到对话框中的特定元素?
可能重复
回答上一个问题:
var container = $('div'), scrollTo = $('#row_8'); container.scrollTop( scrollTo.offset().top - container.offset().top + container.scrollTop() ); // Or you can animate the scrolling: container.animate({ scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop() });