PageSourceSearch

https://www.bookscumbria.com/wp-content/themes/website-theme/js/resize-category-products.js

js bookscumbria.com collected 2026-10-02 10:23:24 UTC 1,643 bytes, 46 lines download raw bytes

1( function ( $ ) {
2    $( document ).ready( function() {
3
4            // set all elements of a row to the same height
5
6            const categoryProducts = $( '#main ul.products' ).children( 'li' );
7            let largestProductOnRow = -1,
8            previousTopPosition = -1,
9            currentTop = -1,
10            productsOnRowArr = [];
11
12            $( categoryProducts ).each( function(){
13
14                // Get the top position of product
15                const height = $( this ).height();
16
17                // if top position matches the last top they are on the same row.
18                if( previousTopPosition == currentTop ) {
19                    height > largestProductOnRow && ( largestProductOnRow = height );
20                    productsOnRowArr.push( $( this ) );
21                }
22                else {
23                    // If there are products on the row.
24                    // Set their height to the tallest on the row.
25                    if( productsOnRowArr.length ) {
26
27                        for( let i = 0; i < productsOnRowArr.length; i++ ) {
28                            $( productsOnRowArr[ i ] ).height( largestProductOnRow );
29                        }
30
31                    }
32
33                    // New row so add current product to array
34                    // Set top to current product
35                    // set tallest to current product
36                    productsOnRowArr = [ $( this ) ];
37                    previousTopPosition = currentTop;
38                    largestProductOnRow = height;
39                }
40
41            })
42
43    })
44
45} ( jQuery ) )
46

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.