Has Columnizer saved you hours? Become a Github Sponsor and buy me a coffee ☕️ 😄
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.
Option Name | Purpose |
---|---|
width | a rough width your columns, and Columnizer will create as many as will fit in the browser window |
height | This option can only be used in conjunction with the width option. When both the width and height options are set, columns will continue to be built to those measurements to fill all of the content. This is useful for scrolling columns horizontally. See sample 5 for an example. |
columns | an alternative to the width option. Sets a static number of columns to build, regardless of widget. |
target | An optional CSS selector may be used here to determine where the columnized content should be placed. If a target is specified, the columnized node will remain unchanged, and the target node will contain columnized content. |
doneFunc | This function will be called when columnizing is complete. |
ignoreImageLoading |
true by default. If set to false, Columnizer will try to wait until images in the content have loaded before columnizing the data. |
columnFloat | default is “left”. Change to “right” for right to left languages. |
lastNeverTallest |
false by default. Set to true to ensure that the last column of the columnized content is not the tallest column. |
buildOnce | if buildOnce is false, the content will be re-columnized when the window is resized. If buildOnce is true, the content will only be columnized once. |
overflow | If this option is used, then a static height is set to the columnized content, and any content that does not fit within the height is put into the element specified by $(id). See demo 1 for an example. |
height (required): the static height for the columnized content | |
id (required): The id of the element to put the remainder of the content | |
doneFunc (optional): a function to be called after the content has been columnized. This is a great place to columnize the remainder content. | |
manualBreaks | Defaults to false. Set to true if you only want to create columns with manual column breaks. If true, then width, height, columns options are ignored. |
disableSingle | Disables single column layout if number of columns is less or equal to 1. Useful to force columns scrolling horizontally on small screens. See demo 5 for an example. | . Default is false.
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. |
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');
You can revert your columnized DOM by using the "uncolumnize" function.
$('selector').uncolumnize();
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.
To compress into a zip file, run compress.sh
Check the issues on the GitHub page