Columnizer will add CSS classes to the columns it creates. Each column will have a "column" classname. The first column will have "first" and last column will have "last". This lets you target specific columns in your CSS markup more easily.
Class Name |
Purpose |
columnbreak |
Any node that has the CSS class “columnbreak” will act as a column break, as you'd expect in any word processor. The "columnbreak" node will always be the last node in its column. Works well with the optional "columnBreak" option. |
dontsplit |
Any node that has the CSS class “dontsplit” won’t be split into multiple columns. This is handy to make sure that tables, etc, aren’t chopped in half if they land at the bottom of a column. |
dontend |
Any node that has the CSS class “dontend” will never be put at the end of a column. |
removeiffirst |
Any node that has the CSS class “removeiffirst” will be removed from the content if it is the first node in a column. |
removeiflast |
Any node that has the CSS class “removeiflast” will be removed from the content if it is the last node in a column. |
Helpful Hints
- You can specify a rough width your columns, and Columnizer will create as many as will fit in the browser window. Just use: $(‘selector’).columnize({width: 400 }) syntax
- You can specify a specific number of columns, and Columnizer will distribute your content between that many columns. Just use: $(‘selector’).columnize({columns: 2 }) syntax
- When using the width and height options to scroll horizontally, make sure that the .column CSS class does not specify any padding or margin or border. See CSS for sample 5 for an example on how to create buffer between columns.
- Make sure that you are columnizing visible content. If your content is display:none it may not columnize correctly. Try visibility:hidden and display:block instead.
- Columnizer does not auto-class any of your content. See the Suggested Defaults For Your Content section.
Suggested Defaults For Your Content
Columnizer does not add default "dontsplit" or "dontend" classes to your content. If you are finding your content is breaking columns at awkward locations, try the following:
$yourContent.find('table, thead, tbody, tfoot, colgroup, caption, label, legend, script, style, textarea, button, object, embed, tr, th, td, li, h1, h2, h3, h4, h5, h6, form').addClass('dontsplit');
$yourContent.find('h1, h2, h3, h4, h5, h6').addClass('dontend');
$yourContent.find('br').addClass('removeiflast').addClass('removeiffirst');
Troubleshooting
Why isn't my content columnizing?
Make sure that your content "has display". If the content you're columnizing has display:none, then the browser has difficulty estimating the size of some nodes, which makes columnizing impossible. instead of display:none, use visibility:hidden and keep display:block. then in the doneFunc() of columnizer, change the visibility and display to whatever your page or application needs.
Additional Notes
Minimize
To compress into a zip file, run compress.sh
Bug report?
Check the issues on the GitHub page