Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Dialog scroll to element in dialog

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?

like image 405
Christian Kolb Avatar asked Mar 27 '12 11:03

Christian Kolb


1 Answers

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()
});​
like image 90
Darbio Avatar answered Sep 19 '22 04:09

Darbio