Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(window).on('debouncedresize load', function(){
- $('[data-normheights]').each(function(){
- var $items = $(this).find($(this).data('normheights')),
- childFilter = $(this).data('normheights-inner'),
- tallest = 0,
- lastYOffset = 0,
- row = [];
- $items.each(function(index){
- var $img = $(this).find(childFilter);
- var yOffset = $(this).position().top;
- if(index == 0) {
- lastYOffset = yOffset;
- } else if(yOffset != lastYOffset) {
- $(row).css('min-height', tallest);
- yOffset = $(this).position().top;
- row.length = 0;
- tallest = 0;
- }
- lastYOffset = yOffset;
- row.push(this);
- var h = $img.height();
- if(h > tallest) tallest = h;
- });
- $(row).css('min-height', tallest);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement