Некодим© 2020-2026 Некодим
Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.
var cover = rec ? rec.querySelector('.t-cover') : null;
914 var coverContainer = rec ? rec.querySelector('.t-cover__container') : null;915 if (!isNeedFixForBackground || !coverContainer || !cover) return;917 var coverHeight = cover.style.height; //cached cover height918 cover.style.height = 0;919 coverContainer.style.height = coverHeight;921 rec.setAttribute('data-fixed-bg', 'y');925 * get height of element without padding927 * @param {HTMLElement} el - current element928 * @returns {number} - height of el930 function t_cover__getPureHeight(el) {932 var elPaddingTop = parseInt(el.style.paddingTop) || 0;933 var elPaddingBottom = parseInt(el.style.paddingBottom) || 0;934 if (el.clientHeight) {935 return el.clientHeight - (elPaddingTop + elPaddingBottom);937 return parseInt(window.getComputedStyle(el).height, 10);942 * return number of element height with it margins944 * @param {HTMLElement} el - current element945 * @return {number} - height947 function t_cover__getFullHeight(el) {949 var elHeight = el.offsetHeight;950 var elMarginTop = parseInt(el.style.marginTop) || 0;951 var elMarginBottom = parseInt(el.style.marginBottom) || 0;952 return elHeight + elMarginTop + elMarginBottom;958 * @param {number} elTopPos - offset top finally position959 * @returns {void} - if current position equals finally position961 function t_cover__scrollToNextSection(elTopPos) {962 var documentHeight = Math.max(963 document.body.scrollHeight,964 document.documentElement.scrollHeight,965 document.body.offsetHeight,966 document.documentElement.offsetHeight,967 document.body.clientHeight,968 document.documentElement.clientHeight970 var bottomViewportPoint = documentHeight - document.documentElement.clientHeight;971 if (elTopPos > bottomViewportPoint) elTopPos = bottomViewportPoint;972 if (elTopPos === window.pageYOffset) return false;973 var currentPosition = window.pageYOffset;974 var step = (elTopPos - currentPosition) / 30;975 var difference = window.pageYOffset;976 var timerID = setInterval(function () {978 window.scrollTo(0, difference);979 document.body.setAttribute('data-scrollable', 'true');981 (elTopPos - currentPosition < 0 && window.pageYOffset <= elTopPos) ||982 (elTopPos - currentPosition > 0 && window.pageYOffset >= elTopPos)984 clearInterval(timerID);985 document.body.removeAttribute('data-scrollable');990 // backward compatibility for BF311N991 function cover_setRecalculatedCoverHeight(a, b) {992 t_cover__setRecalculatedHeight(a, b);994 function t_cover__getHeightWithoutPadding(a) {995 return t_cover__getPureHeight(a);