Guest User

Untitled

a guest
Aug 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. jQuery Equal Heights of Divs
  2. `//Equal Height Divs
  3. function equalHeight( group ) {
  4. var tallest = 0;
  5. group.each(function() {
  6. var thisHeight = $(this).height();
  7. if(thisHeight > tallest) {
  8. tallest = thisHeight;
  9. }
  10. });
  11.  
  12. group.each(function() {
  13. $(this).css( "min-height", tallest );
  14. } );
  15. }`
  16.  
  17. var maxHeight = Math.max.apply(null, $('.common_classname').map(function() {
  18. return $(this).height();
  19. }).get());
  20.  
  21. $('.common_classname').height(maxHeight);
  22.  
  23. function equalHeight( group ) {
  24. var tallest = 0;
  25. group.each(function() {
  26. $(this).css({height:"", "min-height":""});
  27. var thisHeight = $(this).height();
  28. if(thisHeight > tallest) {
  29. tallest = thisHeight;
  30. }
  31. });
  32.  
  33. group.each(function() {
  34. $(this).css( "min-height", tallest );
  35. } );
  36. }
Add Comment
Please, Sign In to add comment