Created
July 5, 2010 03:35
-
-
Save gerardpaapu/463968 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function getContainerDimensions(elements, container){ | |
// Returns an object { top: ..., right: ..., bottom: ..., left: ... } | |
// so that the dimensions will cover all of `elements` | |
// | |
// `container` is the element that the dimensions are relative to | |
return Seq.from(elements) | |
.invoke('getDimensions', container) | |
.pluck('top', 'right', 'bottom', 'left') | |
.unzip().apply(function (tops, rights, bottoms, lefts){ | |
return { | |
'top': tops.min(), 'right': rights.max(), | |
'bottom': bottoms.max(), 'left': lefts.min() | |
}; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment