Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrolling of modal window Bootstrap to bottom

I have a modal window Bootstrap with dynamic height (more than height of screen). How can I scroll the window to bottom programmatically? I tried to do this:

$('#modal').animate({ scrollTop: $('#modal').height() }, 500);

But variable $('#modal').height() is not changing while I'm resizing window. Any ideas?

like image 850
makandroid Avatar asked Jan 04 '23 07:01

makandroid


2 Answers

Solution is very easy:

$('#modal').animate({ scrollTop: $('#modal .modal-dialog').height() }, 500);
like image 190
makandroid Avatar answered Jan 10 '23 13:01

makandroid


The other solution did not work for me however it was close.

Here is what worked for me:

$('#modal').animate({ scrollTop: $('#modal .modal-content').height() }, 'slow');
like image 44
chandler Avatar answered Jan 10 '23 14:01

chandler