Skip to content

Commit

Permalink
Vertically aligning skill summary blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Francismb committed May 19, 2016
1 parent 59e8a0e commit d6aaef3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/assets/javascripts/skills.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
*/
"use strict";
$(window).load(function () {

/**
* The skills collection.
* @type {*|jQuery|HTMLElement}
*/
var skills = $('.skills > section');

/**
* The summaries collection.
* @type {*|jQuery|HTMLElement}
*/
var summaries = $('.skills > section p');

/**
* Calculate the maximum height for the skill boxes and
* set the skill boxes to all have the maximum height.
Expand All @@ -19,4 +26,15 @@ $(window).load(function () {
max_height = Math.max(max_height, $(this).height());
});
skills.height(max_height);

/**
* Calculate and set the maximum height for each of
* the summaries in the skill boxes.
* @type {number}
*/
max_height = 0;
summaries.each(function () {
max_height = Math.max(max_height, $(this).height());
});
summaries.height(max_height);
});
2 changes: 2 additions & 0 deletions app/assets/stylesheets/skills.css.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ a.edit-skill {
}
.skills > .third p
{
display: table-cell;
vertical-align: middle;
margin-bottom: 0;
}

0 comments on commit d6aaef3

Please sign in to comment.