diff options
author | Matt Banks <mjbanks@gmail.com> | 2015-12-02 08:35:51 -0500 |
---|---|---|
committer | Matt Banks <mjbanks@gmail.com> | 2015-12-02 08:35:51 -0500 |
commit | 02c20fb28f9bd896d222a807e10d320e7c738a4a (patch) | |
tree | f64de3a1a602e59f9edac2aee696c7e98eb3a577 /README.md | |
parent | 69d5afef56d42f30eb4804e9e8dd0a213b61f56c (diff) | |
parent | 4f9081986061f5c3eed29a620f0ce3fd0600cd02 (diff) | |
download | jQuery.equalHeights-02c20fb28f9bd896d222a807e10d320e7c738a4a.zip jQuery.equalHeights-02c20fb28f9bd896d222a807e10d320e7c738a4a.tar.gz jQuery.equalHeights-02c20fb28f9bd896d222a807e10d320e7c738a4a.tar.bz2 |
Merge pull request #15 from osartun/master
Adding `watch` option among other things
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 26 |
1 files changed, 23 insertions, 3 deletions
@@ -21,16 +21,35 @@ Alternatively, install with [bower](https://github.com/bower/bower): ### Auto Initialize Add `data-equal="MYELEMENTS"` to the parent container, where MYELEMENTS is div, section, li, whatever you'd like. [See the example](https://github.com/mattbanks/jQuery.equalHeights/blob/master/example/example.html) for more information. +You can specify options by setting them as a data-attribute, for example: `data-watch="true"`. ### Manually Initialize - $('.yourelements').equalHeights(); + $('.yourelements').equalHeights([options]); -Select whatever elements need equal height. +Select whatever elements need equal height. You can optionally pass in an object with one or more options + +#### Option: `wait` + +If you pass in `{wait: true}` your elements' height will only be equalized as soon as they have layout. + + $('.yourelements').equalHeights({wait: true}); + +#### Option: `watch` + +Pass in `{watch: true}` if you want to execute `equalHeights` on resize. This can improve the responsiveness of the elements with equalized heights. + + $('.yourelements').equalHeights({watch: true}); + +#### Option: `unwatch` + +Pass in `{unwatch: true}` to unwatch a set of elements that are currently watched. + + $('.yourelements').equalHeights({unwatch: true}); ### Caveats -If using @font-face or Google Web Fonts, you may need to wrap the function call in a `setTimeout` for 100ms-200ms (`jQuery.height()` needs to fire after the font is rendered to properly calculate the height). +If using @font-face or Google Web Fonts, you may need to wrap the function call in a `setTimeout` for 100ms-200ms or call it on `window` `load` (`jQuery.height()` needs to fire after the font is rendered to properly calculate the height). Otherwise even the `wait` option could fail here as the element might be rendered and have layout before the fonts are loaded and applied. ## Requirements/Browsers @@ -47,6 +66,7 @@ See `example.html` in examples folder. * [betweenbrain](https://github.com/betweenbrain) * [Korri](https://github.com/Korri) * [pafnuty](https://github.com/pafnuty) +* [osartun](https://github.com/osartun) ### Changelog |