1document.addEventListener('DOMContentLoaded', function() { 2 const container = document.querySelector('.marquee-container'); 3 const track = document.getElementById('marqueeTrack'); 4 const isMobile = window.matchMedia('(max-width: 768px)').matches; 5 6 if (!isMobile) { 7 // РаÑÑÑиÑÑваем обÑÑÑ ÑиÑÐ¸Ð½Ñ ÑлеменÑов 8 let totalWidth = 0; 9 const items = track.children; 10 11 Array.from(items).forEach(item => { 12 const style = window.getComputedStyle(item); 13 totalWidth += item.offsetWidth + 14 parseInt(style.marginRight) + 15 parseInt(style.marginLeft); 16 }); 17 18 // ÐлониÑÑем ÑлеменÑÑ Ð´Ð¾ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ 200% ÑиÑÐ¸Ð½Ñ ÑкÑана 19 const containerWidth = container.offsetWidth; 20 let clonesCount = 0; 21 22 while (track.offsetWidth < containerWidth * 2) { 23 Array.from(items).forEach(item => { 24 const clone = item.cloneNode(true); 25 track.appendChild(clone); 26 }); 27 clonesCount++; 28 29 // ÐаÑиÑа Ð¾Ñ Ð±ÐµÑконеÑного Ñикла 30 if (clonesCount > 10) break; 31 } 32 33 // ÐаÑÑÑаиваем анимаÑÐ¸Ñ 34 const singleLoopWidth = totalWidth + (items.length * 20); // 20px margin-right 35 const animationDuration = (singleLoopWidth * 2) / 50; // 50px/s ÑкоÑоÑÑÑ 36 37 track.style.animationDuration = `${animationDuration}s`; 38 track.style.width = `${singleLoopWidth * 2}px`; 39 } 40});
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.