Created
November 29, 2013 15:08
-
-
Save sevenbest/7707068 to your computer and use it in GitHub Desktop.
JavaScript: Vertical Align
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
| // taken from ink eb website, our-partners pages. parent-count is a class added just to count the number of elements. | |
| $(window).load(function () { | |
| for (var i = $('.parent-count').length; i >= 0; i--) { | |
| var parentHeight = $('#parent-' + i).height(); | |
| var childHeight = $('#child-' + i).height(); | |
| $('#child-' + i).css('margin-top', (parentHeight - childHeight) / 2); | |
| }; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment