Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. // type 3: 2 columns of floated elements, pairs are equal heights
  2. // and last element stretch to full width if an unmatched pair
  3.  
  4. $('.links-with-desc.type-3').each( function() {
  5. $(this).innerWidth( maxWidth );
  6. $(this).children().each( function(i) {
  7. $(this).innerWidth( (maxWidth / 2) ).css('float', 'left');
  8. if(i == 0 || (i + 1) % 4 == 0 || i % 4 == 0) {
  9. $(this).css('background', '#161616').css('color', '#ddccdd');
  10. $(this).find('a').css('color', '#ffeeaa');
  11. }
  12. if((i - 1) % 3 == 0)
  13. $(this).css('background', '#ffeeaa');
  14. if(i % 2 != 0) { // odd number
  15. if($(this).prev().height() < $(this).height())
  16. $(this).prev().height( $(this).height() );
  17. else if($(this).prev().height() > $(this).height())
  18. $(this).height( $(this).prev().height() );
  19. }
  20. else { // even number (remember index starts with 0!)
  21. if($(this).hasClass('last'))
  22. $(this).innerWidth( maxWidth );
  23. }
  24. });
  25. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement