Некодим© 2020-2026 Некодим
Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.
t_quiz__resizePopup(rec);
1017 const stepsHeightCacheKey = `${rec.id}_step${activeStep.getAttribute('data-step-index')}`;1021 const stepsHeightCache = t_quiz__getStepsHeightFromCache(rec.id);1022 if (forceRecalculate || !stepsHeightCache.has(stepsHeightCacheKey)) {1023 newHeight = calculateNewHeight();1024 stepsHeightCache.set(stepsHeightCacheKey, newHeight);1026 newHeight = stepsHeightCache.get(stepsHeightCacheKey);1029 if (isPopup) t_quiz__resizePopup(rec, newHeight);1031 // Устанавливаем новую высоту с плавным переходом1032 quizWrapper.style.overflow = 'hidden';1033 setTimeout(function () {1034 quizWrapper.style.overflow = '';1037 if (isResultActive) {1038 // Для правильного расчета высоты внутри результата (100%),1039 // нужно чтобы у самого шага была явно указана высота1040 applyHeightToElement(activeStep, newHeight);1043 if (!t_quiz__isMobile()) {1044 applyHeightToElement(quizWrapper, newHeight);1047 function calculateNewHeight() {1048 var MIN_HEIGHT = 500;1049 var quizStyle = getComputedStyle(quiz);1050 var main = rec.querySelector('.t-quiz__main');1051 var panel = rec.querySelector('.t-quiz__panel');1052 // Учитывается только НЕ sticky footer.1053 var footer = rec.querySelector('.t-quiz__content-wrapper > .t-quiz__footer');1055 var panelType = quizStyle.getPropertyValue('--panel-type');1056 var shouldIncludeHeader = panelType === 'header';1057 var hasSidebar = panelType === 'sidebar';1058 var mainHeight = main ? main.offsetHeight : 0;1059 var headerHeight = shouldIncludeHeader ? panel.offsetHeight : 0;1060 var footerHeight = footer ? footer.offsetHeight : 0;1062 var contentPadding = parseInt(quizStyle.getPropertyValue('--content-padding'), 10) * 2;1064 if (mainHeight <= 0) return MIN_HEIGHT;1065 var newHeight = mainHeight + headerHeight + footerHeight + contentPadding;1068 newHeight = Math.max(calculateSidebarHeight(panel), newHeight);1071 var oldHeight = parseInt(getComputedStyle(quizWrapper).height, 10);1073 if (oldHeight <= MIN_HEIGHT && newHeight <= oldHeight) {1074 newHeight = oldHeight;1077 if (isResultActive) {1078 newHeight = Math.max(newHeight, MIN_HEIGHT);1084 function calculateSidebarHeight(panel) {1085 // высчитываем высоту таким образом, так как offsetHeight включает только видимую часть элемента1086 var panelMain = rec.querySelector('.t-quiz__panel__main');1087 var panelExtraText = rec.querySelector('.t-quiz__text-extra');1088 var panelMainHeight = panelMain ? panelMain.offsetHeight : 0;1089 var panelExtraTextHeight = panelExtraText ? panelExtraText.offsetHeight : 0;1090 var sidebarStyle = getComputedStyle(panel);1091 var sidebarPaddingTop = parseInt(sidebarStyle.getPropertyValue('--sidebar-padding-top'), 10);1092 var sidebarPaddingBottom = parseInt(sidebarStyle.getPropertyValue('--sidebar-padding-bottom'), 10);1093 var sidebarGap = panelExtraText ? parseInt(sidebarStyle.getPropertyValue('--sidebar-gap'), 10) : 0;1096 panelMainHeight + panelExtraTextHeight + sidebarPaddingTop + sidebarPaddingBottom + sidebarGap;1097 return sidebarHeight;1100 function applyHeightToElement(element, newHeight) {