6

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 Answer 1

9

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()
});​
3
  • Ok I didn't know that this would also work within other contains. Thanks a lot. Mar 27, 2012 at 11:28
  • No worries. The dialog box is just another div so it will work in that too.
    – Darbio
    Mar 27, 2012 at 11:40
  • Yes I testet it and it does. Thanks again. Mar 27, 2012 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.