1jQuery(document).ready(function($) { 2 if (window.RZCPS && typeof RZCPS.applyResponsiveGridClip === 'function') { 3 RZCPS.applyResponsiveGridClip(); 4 } 5 6 $('.rzcps-container').each(function () { 7 const container = $(this); 8 const marquee = container.find('.rzcps'); 9 const isVertical = container.hasClass('vertical'); 10 const isSlide = container.hasClass('slide'); 11 12 if (!isSlide) return; 13 14 const items = marquee.find('.item'); 15 const speed = parseInt(container.data('speed')) || 50; 16 const visible = isVertical ? parseInt(container.data('visible'), 10) || 1 : 1; 17 const interval = speed * 20; 18 const total = items.length; 19 let currentIndex = 0; 20 21 // Apply styles for both vertical and horizontal 22 if (isVertical) { 23 if (window.RZCPS && typeof RZCPS.applyResponsiveGridClip === 'function') { 24 RZCPS.applyResponsiveGridClip(); 25 } 26 let tallest = 0; 27 items.each(function () { 28 tallest = Math.max(tallest, $(this).outerHeight(true)); 29 }); 30 items.css('height', tallest + 'px'); 31 const itemHeight = tallest; 32 marquee.css({ 33 display: 'flex', 34 flexDirection: 'column', 35 transition: 'transform 0.5s ease', 36 willChange: 'transform', 37 height: itemHeight * total + 'px', 38 }); 39 40 // Set the container's height 41 container.css('height', itemHeight * visible + 'px'); 42 43 function slideToVertical(index) { 44 const distance = -itemHeight * index; 45 marquee.css('transform', `translateY(${distance}px)`); 46 } 47 48 slideToVertical(currentIndex); 49 50 let timer = setInterval(() => { 51 const maxIndex = total - visible; 52 currentIndex = (currentIndex + 1) > maxIndex ? 0 : currentIndex + 1; 53 slideToVertical(currentIndex); 54 }, interval); 55 56 container.hover(() => clearInterval(timer), () => { 57 timer = setInterval(() => { 58 const maxIndex = total - visible; 59 currentIndex = (currentIndex + 1) > maxIndex ? 0 : currentIndex + 1; 60 slideToVertical(currentIndex); 61 }, interval); 62 }); 63 64 } else { 65 // Horizontal sliding logic 66 container.css('position', 'relative').css('overflow', 'hidden'); 67 68 // Force full width for each item 69 items.css({ 70 width: '100%', 71 flexShrink: 0, 72 }); 73 74 // Set .rzcps to horizontal row and wide enough to hold all items 75 marquee.css({ 76 display: 'flex', 77 flexDirection: 'row', 78 width: `${100 * total}%`, 79 transition: 'transform 0.5s ease' 80 }); 81 82 function slideToHorizontal(index) { 83 const percent = -(100 * index); 84 marquee.css('transform', `translateX(${percent}%)`); 85 } 86 87 slideToHorizontal(currentIndex); 88 89 let timer = setInterval(() => { 90 currentIndex = (currentIndex + 1) % total; 91 slideToHorizontal(currentIndex); 92 }, interval); 93 94 container.hover(() => clearInterval(timer), () => { 95 timer = setInterval(() => { 96 currentIndex = (currentIndex + 1) % total; 97 slideToHorizontal(currentIndex); 98 }, interval); 99 }); 100 } 101 }); 102});
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.