<...">

Enable scroll on single div?

I have a layout that looks like this:

<html> <head> stuff here </head> <body> <div id="master"> <div id="toolbar"> <input type="text" id="foo"> </div> <div id="content"> a whole bunch of content in here </div> </div> </body> </html> 

'# master' is a container for the jquery user interface dialog box. I would like the contents of the "#content" div to be scrollable, but for the "#toolbar" it would NOT scroll. Is this possible with the jquery UI dialog box?

+4
source share
2 answers

Just use the css rules:

 #content { overflow: auto; height: [desired height] } 

Where you might need to use jQuery if the modal has dynamic height. In this case, on the open modality, you can set the height of the inner container. Sort of:

 open: function(){ var modalHeight = $('#master').height(); $('#content').height(modalHeight - [footer and title]); } 
+10
source

Use CSS to give the #content div a given height and possibly width, and set the CSS overflow: auto property on that div. If the content exceeds the height, you will get a scroll bar.

0
source

Source: https://habr.com/ru/post/1339385/


All Articles