1/** 2 * Sticky header â no-op. 3 * 4 * Sticky behavior is handled by CSS rule `header.header { position: sticky; top: 0 }` 5 * in /css/styles.css. Previous JS approaches set `position: fixed` on 6 * `.header__wrapper`, which conflicts with `body { transform }` from the page 7 * fade-in animation â fixed elements get anchored to the (scrolling) body 8 * instead of the viewport. 9 * 10 * File kept (as no-op) so existing <script src="/js/sticky-header.js?v=..."> tags 11 * in 60+ HTML files don't 404. 12 */ 13(function () { 14 'use strict'; 15})(); 16 17/* ââ Header._compact: ÑменÑÑаем логоÑип-Ð¾Ð»ÐµÐ½Ñ Ð¿Ñи ÑкÑолле вниз âââââââââââââ 18 Ðобилка (â¤767px): из «вÑÑÑÑÐ¿Ð°ÐµÑ Ð½Ð¸Ð¶Ðµ баÑа» â «впиÑан в баÑ». 19 ÐеÑкÑоп (>767px): мÑгко Ñкейлим ÑкÑипÑ-логоÑип на 0.85 â даÑÑ Ð¿Ð»Ð°Ð²Ð½Ð¾Ðµ 20 ÑменÑÑение пÑи ÑкÑолле (CSS transition: transform .2s Ñже еÑÑÑ Ð² main.css). 21 Threshold = 20px scrollY. 22 âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ */ 23(function () { 24 'use strict'; 25 26 var THRESHOLD = 20; 27 28 var header = document.querySelector('header.header'); 29 if (!header) return; 30 31 function currentScroll() { 32 // УÑиÑÑваем оба ÑÑенаÑиÑ: и ÑÑандаÑÑнÑй (scroll на documentElement), 33 // и Astro-/Bitrix-ÑбоÑки где html/body имеÑÑ Ñвой overflow-y: auto 34 // и ÑакÑиÑеÑки ÑкÑоллиÑÑÑ body. 35 return Math.max( 36 window.scrollY || 0, 37 document.documentElement.scrollTop || 0, 38 document.body.scrollTop || 0, 39 ); 40 } 41 42 function update() { 43 if (currentScroll() > THRESHOLD) { 44 header.classList.add('_compact'); 45 } else { 46 header.classList.remove('_compact'); 47 } 48 } 49 50 update(); 51 window.addEventListener('scroll', update, { passive: true }); 52 window.addEventListener('resize', update, { passive: true }); 53 document.addEventListener('scroll', update, { passive: true }); 54 document.body.addEventListener('scroll', update, { passive: true }); 55}());
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.