Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added coffeescript snippet to make all items the equal height
- Loading branch information
Mathias Helin
committed
Jun 2, 2014
1 parent
0116742
commit df54a6c
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## Snippet to distribute heights on a couple of elements | ||
|
||
# the wrap | ||
$wrap = $('[data-distribute-height]') | ||
|
||
# we want each wrap seperate | ||
$wrap.each -> | ||
maxHeight = 0 | ||
$items = $(this).find '.item' | ||
|
||
# reset the height, so it can be recalculated | ||
$items.height 'auto' | ||
|
||
# check the height of each item, if it's bigger that the highest at that point, overwrite the maxHeight | ||
$items.each -> | ||
height = $(this).height() | ||
|
||
if height > maxHeight | ||
maxHeight = height | ||
|
||
# set the height for all items | ||
$items.height maxHeight |