(function() {
const block = document.querySelector('#rec2215525461');
if (!block) return;
// Создаем обертку для содержимого
const inner = document.createElement('div');
inner.classList.add('t-horizontal-scroll-inner');
// Переносим весь контент блока внутрь inner
while (block.firstChild) {
inner.appendChild(block.firstChild);
}
block.appendChild(inner);
const updateScroll = () => {
const rect = block.getBoundingClientRect();
const windowHeight = window.innerHeight;
// Процент прокрутки блока относительно окна
let scrollPercent = 1 - (rect.top / windowHeight);
scrollPercent = Math.min(Math.max(scrollPercent, 0), 1);
// Максимальный сдвиг блока
const maxTranslate = inner.scrollWidth - window.innerWidth;
const translateX = maxTranslate * scrollPercent;
inner.style.transform = `translateX(-${translateX}px)`;
};
window.addEventListener('scroll', updateScroll);
window.addEventListener('resize', updateScroll);
updateScroll();
})();