jQuery Dialog scroll to element in dialog

2019-02-17 06:09发布

I have the following issue:

I open a dialog box with jQuery UI. This dialog box contains a lot of content, which can't be displayed at once.

Is it possible to scroll to a specific element within the dialog box?

1条回答
闹够了就滚
2楼-- · 2019-02-17 06:20

Possible duplicate

Answer from previous question:

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()
});​
查看更多
登录 后发表回答