jQuery对话框滚动到对话框中的元素 [英] jQuery Dialog scroll to element in dialog
本文介绍了jQuery对话框滚动到对话框中的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下问题:
我打开一个带有jQuery UI的对话框。此对话框包含大量内容,无法一次显示。
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?
推荐答案
从上一个问题回答:
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()
});
这篇关于jQuery对话框滚动到对话框中的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文