PageSourceSearch

https://worldjusticeproject.org/themes/custom/wjp/js/no10-equal-height.js?tlrzz3

js worldjusticeproject.org collected 2026-09-24 08:29:24 UTC 2,264 bytes, 66 lines download raw bytes

1/**
2 * @file
3 * A JavaScript file for the theme that provides for equal height.
4 *
5 */
6
7(function ($, Drupal, window, document, undefined) {
8
9  Drupal.behaviors.no10_equal_height = {
10    attach: function(context, settings) {
11
12      /* Thanks to CSS Tricks for pointing out this bit of jQuery
13       http://css-tricks.com/equal-height-blocks-in-rows/
14       It's been modified into a function called at page load and then each time
15       the page is resized. One large modification was to remove the set height
16       before each new calculation. */
17
18      no10equalheight = function(container){
19
20        $(container).each(function() {
21          var currentTallest = 0,
22            currentRowStart = 0,
23            rowDivs = new Array(),
24            $el,
25            topPosition = 0;
26          $(this).find('.equalheight--item').each(function () {
27
28            $el = $(this);
29            $($el).height('auto');
30            topPostion = $el.position().top;
31
32            if (currentRowStart != topPostion) {
33              for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
34                rowDivs[currentDiv].height(currentTallest);
35              }
36              rowDivs.length = 0; // empty the array
37              currentRowStart = topPostion;
38              currentTallest = $el.height();
39              rowDivs.push($el);
40            } else {
41              rowDivs.push($el);
42              currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
43            }
44            for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
45              rowDivs[currentDiv].height(currentTallest);
46            }
47          });
48        });
49      };
50
51      /********** Equal Heights for specified elements. *********/
52      // Need to add the class 'equalheight--group' to the group.
53      // Need to add the class 'equalheight--item' to the group items.
54      $(window).on('load', function() {
55        no10equalheight('.equalheight--group');
56      });
57      $(window).resize(function(){
58        no10equalheight('.equalheight--group');
59      });
60      $(document).ajaxComplete(function(event, request, settings){
61        no10equalheight('.equalheight--group');
62      });
63    }
64  };
65
66})(jQuery, Drupal, this, this.document);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.