SHARE
TWEET

Equal height Funktion für Bootstrap3 Grid mit Grid Elements

a guest Oct 17th, 2014 171 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Equal height Funktion für Bootstrap Gridelements
  2. // (c) Andreas Becker <andreas.becker@websedit.de>
  3. equalheight = function(){
  4.         var kids = 0,
  5.                         colDivs = new Array(),
  6.                         maxHeight = 0;
  7.         // Klasse .equal-height suchen
  8.         $('.equal-height').each(function() {
  9.                 kids = $(this).children();
  10.                 // alle Kindelemente davon in Array schreiben
  11.                 kids.each(function() {
  12.                         colDivs.push($(this).height());
  13.                 });
  14.                 // größte Höhe der Kinder ermitteln
  15.                 maxHeight = Math.max.apply(Math, colDivs);
  16.                 // alle Kinder mit entsprechender Höhe versehen
  17.                 $(this).children().height(maxHeight);
  18.         });
  19. }
  20. // Wenn Seite geladen
  21. $(window).load(function() {
  22.         equalheight();
  23. });
  24. // Wenn Seitengröße angepasst
  25. $(window).resize(function(){
  26.         equalheight();
  27. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top