1/* Latest Blog Carousel â Slick initialisation + equal-height rows. */ 2( function ( $ ) { 3 'use strict'; 4 5 /** 6 * Give every card's title block and excerpt block a uniform height 7 * (the tallest in the carousel, clones included) so the author/date 8 * meta always lines up across the row, like the reference design. 9 */ 10 function matchHeights( $carousel ) { 11 [ '.lbc-card-title', '.lbc-card-excerpt' ].forEach( function ( sel ) { 12 var $els = $carousel.find( sel ); 13 if ( ! $els.length ) { 14 return; 15 } 16 17 // Reset before measuring so we get natural heights. 18 $els.css( 'min-height', '' ); 19 20 var max = 0; 21 $els.each( function () { 22 max = Math.max( max, this.offsetHeight ); 23 } ); 24 25 $els.css( 'min-height', max + 'px' ); 26 } ); 27 } 28 29 function matchAll() { 30 $( '.lbc-carousel' ).each( function () { 31 matchHeights( $( this ) ); 32 } ); 33 } 34 35 function initCarousels() { 36 $( '.lbc-carousel' ).each( function () { 37 var $carousel = $( this ); 38 39 // Guard against double-init (e.g. DIVI AJAX re-renders). 40 if ( $carousel.hasClass( 'slick-initialized' ) ) { 41 return; 42 } 43 44 var slides = parseInt( $carousel.closest( '.lbc-wrap' ).data( 'slides' ), 10 ) || 3; 45 46 $carousel.on( 'init setPosition', function () { 47 matchHeights( $carousel ); 48 } ); 49 50 $carousel.slick( { 51 slidesToShow: slides, 52 slidesToScroll: 1, 53 infinite: true, 54 arrows: true, 55 dots: false,
56 prevArrow: false, // Single forward arrow, matching the reference. 57 nextArrow: '<button type="button" class="lbc-next slick-next" aria-label="Next posts">' + 58 '<svg width="17" height="27" viewBox="0 0 17 27" fill="none" xmlns="http://www.w3.org/2000/svg">' + 59 '<path d="M3.75795 27L17 13.5L3.75795 0L0 3.83116L9.48688 13.5L0 23.1688L3.75795 27Z" fill="#DFDFDF"/>' + 60 '</svg></button>', 61 speed: 400, 62 responsive: [ 63 { 64 breakpoint: 1024, 65 settings: { 66 slidesToShow: Math.min( 2, slides ) 67 } 68 }, 69 { 70 breakpoint: 767, 71 settings: { 72 slidesToShow: 1, 73 arrows: false, 74 dots: true 75 } 76 } 77 ] 78 } ); 79 } ); 80 } 81 82 $( function () { 83 initCarousels(); 84 } ); 85 86 // Re-init / re-measure after DIVI Builder / AJAX content swaps. 87 $( document ).on( 'et_pb_after_init_modules', initCarousels ); 88 89 // Fonts/images can change heights after first paint. 90 $( window ).on( 'load', function () { 91 initCarousels(); 92 matchAll(); 93 } ); 94 95 // Keep rows aligned on resize (debounced). 96 var resizeTimer; 97 $( window ).on( 'resize', function () { 98 clearTimeout( resizeTimer ); 99 resizeTimer = setTimeout( matchAll, 150 ); 100 } ); 101} )( jQuery );
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.