Skip to content

Instantly share code, notes, and snippets.

@LeonFedotov
Created February 1, 2013 08:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeonFedotov/4690111 to your computer and use it in GitHub Desktop.
Save LeonFedotov/4690111 to your computer and use it in GitHub Desktop.
A small script for hackathon.io - http://www.hackathon.io/events that makes tiles look better.
(function() {
var all = $('.block-grid.five-up > li').toArray();
all.slice(5).forEach(function(current, index) {
index += 5;
var el = $(current),
offset = el.offset(),
above = $(all[index-5]);
el.css({
position: 'relative',
top: -1*(offset.top - (above.offset().top + above.height()) - 16)+'px'
})
});
var maxHeight = Math.max.apply(Math,
all.slice(-5).map(function(current) { return $(current).offset().top+$(current).height(); })
);
$('.block-grid').height(maxHeight - $('.block-grid').offset().top);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment