1(function ($, Drupal) { 2 Drupal.behaviors.bannerCarousel = { 3 attach: function (context, settings) { 4 const settingsGroup = settings.swiper || {}; 5 const carousels = once('bannerBehaviour', '.banner-carousel-slider:not(:has(.banner-carousel-image-only))', context); 6 carousels.forEach(function (el) { 7 var elementId = el.id; 8 swiperBlockSettings = settingsGroup.hasOwnProperty(elementId) ? settingsGroup[elementId] : {} 9 const sliderSpeed = parseInt(swiperBlockSettings.speed) || 3000; 10 const slidesPerView = swiperBlockSettings.slidesPerView || 1; 11 const sliderEffect = swiperBlockSettings['effect'] || 'slide'; 12 const swiperOptions = { 13 slidesPerView: slidesPerView, 14 autoHeight: true, 15 autoplay: { 16 delay: sliderSpeed, 17 }, 18 loop: true, 19 navigation: { 20 nextEl: '.swiper-button-next', 21 prevEl: '.swiper-button-prev', 22 }, 23 pagination: { 24 el: el.querySelector('.swiper-pagination'), 25 clickable: true, 26 }, 27 }; 28 // If fade effect is enabled 29 swiperOptions.effect = sliderEffect; 30 if (swiperOptions.effect == 'fade') { 31 swiperOptions.fadeEffect = { crossFade: true }; 32 } 33 new Swiper(el, swiperOptions); 34 el.classList.add('swiper-initialized'); 35 }); 36 37 function setBannerCarouselItemsHeight() { 38 if ($(window).width() <= 960) { 39 var maxHeight = 0; 40 var $items = $('.banner-carousel-item'); 41 $items.css('height', 'auto'); 42 $items.each(function() { 43 var thisHeight = $(this).outerHeight(); 44 if (thisHeight > maxHeight) { 45 maxHeight = thisHeight; 46 } 47 }); 48 $items.css('height', maxHeight + 'px'); 49 } 50 } 51 $(window).on('load resize', setBannerCarouselItemsHeight); 52 } 53 }; 54})(jQuery, Drupal);
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.