View Full Version : Accordion list expands outside container div

12-18-2012, 08:53 PM
1) Script Title: Bullet List Accordion Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-bullet.htm

3) Describe problem: When the list is expanded, it can push content below the container div's bottom. The container div should expand with the list. You can view it at http://dev.inkari.com/experience.php. When you expand the first list you should see the red type pushed below the containing div (a light gray boxed area).

As an aside, the expand/close buttons are list-style-images. I noticed that in Firefox, the entire list gets highlighted when these buttons are clicked. Doesn't happen in Safari or Chrome.


12-18-2012, 10:31 PM
That text:

This text gets pushed below the containing div's bottom edge.
The containing div should expand with the list.

is actually inside the container (div class="arrowlistmenu") for the accordion. So of course it will get pushed around.

What you need to do is to set an explicit height for the arrowlistmenu div and set its overflow to hidden. Make sure that the height is able to accommodate the tallest content that there will be in there, but no higher. About 250 to 300 px should be enough. Use as short as is possible, to allow room for other stuff if you want it. If it's OK with you that that other stuff get covered that might not matter. Then simply put anything else you want around there outside of the arrowlistmenu div.

12-19-2012, 03:01 AM
Hi John, thanks for the idea. That works, but it forces the containing div to be excessively long when the list is closed. The challenge is to get the containing div to expand when the list expands and retract when the list is closed.


12-19-2012, 04:13 AM
Instead of an explicit height, then set an explicit max-height.

12-19-2012, 05:46 AM
That didn't work. I noticed that the containing div expands on refresh and wondered if there is a way to refresh the browser when a list is expanded. This idea feels like a work-around but could work.