Advertisement
Guest User

Untitled

a guest
May 24th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. $(window).on('debouncedresize load', function(){
  2. $('[data-normheights]').each(function(){
  3. var $items = $(this).find($(this).data('normheights')),
  4. childFilter = $(this).data('normheights-inner'),
  5. tallest = 0,
  6. lastYOffset = 0,
  7. row = [];
  8. $items.each(function(index){
  9. var $img = $(this).find(childFilter);
  10. var yOffset = $(this).position().top;
  11. if(index == 0) {
  12. lastYOffset = yOffset;
  13. } else if(yOffset != lastYOffset) {
  14. $(row).css('min-height', tallest);
  15. yOffset = $(this).position().top;
  16. row.length = 0;
  17. tallest = 0;
  18. }
  19. lastYOffset = yOffset;
  20. row.push(this);
  21. var h = $img.height();
  22. if(h > tallest) tallest = h;
  23. });
  24. $(row).css('min-height', tallest);
  25. });
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement