Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,56 @@ You must select a every element which will be used in the grids calculation, the
</div>
```

You can also resize the columns whenever the window size changes with the following code:

```
(function (sel, len) {
sel.equalHeight();

// From http://stackoverflow.com/a/4541963/6461688
var waitForFinalEvent = (function () {
var timers = {};
return function (callback, ms, uniqueId) {
if (!uniqueId) {
uniqueId = "Don't call this twice without a uniqueId";
}
if (timers[uniqueId]) {
clearTimeout (timers[uniqueId]);
}
timers[uniqueId] = setTimeout(callback, ms);
};
})();

$(window).resize(function () {
waitForFinalEvent(function () {
sel.each(function () {
this.style.height = null;
});
sel.equalHeight();
},
50,
// From http://stackoverflow.com/a/1349426/6461688
(function (len) {
if (!len) {
len = 10;
}

var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

for (var i = 0; i < len; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}

return text;
})(len)
);
});
})('.element');
```

This keeps the columns responsive and allows the column height to shrink when the window is enlarged.

Demo
----

Expand Down