Created
February 1, 2013 08:33
-
-
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.
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
(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