jquery - Resizing Elements to fit their container -


i have container used show breadcrumb path through series of documents selected.

each breadcrumb element single div, floated left stack nicely behind 1 another. width set text content, title of document. lengths vary greatly.

what should happen: when breadcrumb list of elements becomes long displayed in container should resize, ensuring of them remain visible within container.

the problem: seems work, point. once list of breadcrumbs become long container divide container width number of breadcrumb elements exist, , set elements widths accordingly. however, not work consistently, showing last document in list, refusing show direct parent if selected.

ideally breadcrumb elements should keep shrinking make sure displayed, in same way window icons sized display in windows taskbar.

iv made little fiddle highlight going on, , here can see elements not resizing correctly make sure displayed. obvious 8 or more elements added.

http://jsfiddle.net/maxvk/drw9j/30/

can tell me doing wrong please?

many thanks

mvk

you have subtract padding, margins , border size (in case : 9px, 2*3 padding, 2*1 border , 1 left margin) buttons width:

var lok = (bredwid / butcount)-9; 

http://jsfiddle.net/drw9j/35/

here simple example:

http://jsfiddle.net/drw9j/34/

you notice total width not equal container width (there small blank after buttons), due rounding of width.

in first example (your version), blank @ end due buttons smaller lok.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -