Каталог файловtilda-step-form-1.1.js
501 var closeMarginTop = parseFloat(closeStyles.marginTop);502 var closeMarginBottom = parseFloat(closeStyles.marginBottom);503 if (!isNaN(closeMarginTop) && !isNaN(closeHeight)) closeHeight += closeMarginTop;504 if (!isNaN(closeMarginBottom) && !isNaN(closeHeight)) closeHeight += closeMarginBottom;505 topCoordinateForm = topCoordinateForm - closeHeight - 4;506 }507 }508 509 popup.scrollTop = topCoordinateForm;510 } else {511 // prettier-ignore512
История файла и сравнение версий
topCoordinateForm = rec.querySelector('.t-form__screen').getBoundingClientRect().top + window.pageYOffset - 150;
513 if (topCoordinateForm < window.scrollY) { 514 window.scrollTo(0, topCoordinateForm); 520 function t_form__calculateCoverHeight() { 521 var cover = rec.querySelector('.t-cover'); 522 var coverContent = rec.querySelector('div[data-hook-content]'); 523 var coverCarrier = rec.querySelector('.t-cover__carrier'); 525 // ничего не делаем, если блок без обложки 526 if (!cover || !coverContent || !coverCarrier) return; 528 var coverHeight = cover.offsetHeight; 529 var coverContentHeight = coverContent.offsetHeight; 530 var startHeight = coverCarrier.getAttribute('data-content-cover-height'); 533 if (startHeight.indexOf('px') !== -1) { 534 startHeight = parseInt(startHeight); 536 startHeight = window.innerHeight * (parseInt(startHeight) / 100); 540 if (coverContentHeight > 300) { 541 // FIXME: что за число 120? отступ сверху и снизу по 60? 542 coverContentHeight += 120; 544 if (coverContentHeight > 1000) { 545 // FIXME: что за число 100? дополнительный отступ сверху и снизу по 50? 546 coverContentHeight += 100; 549 if (coverContentHeight < startHeight) { 550 coverContentHeight = startHeight; 553 // обновляем высоту обложки, только если размер контента изменился. 554 if (coverHeight !== coverContentHeight) { 555 var coverFilter = rec.querySelector('.t-cover__filter'); 556 var coverWrapper = rec.querySelector('.t-cover__wrapper'); 557 var coverContainer = rec.querySelector('.t-cover__container'); 559 console.log('auto correct cover height: ' + coverContentHeight); 560 if (cover) cover.style.height = coverContentHeight + 'px'; 561 if (coverCarrier) coverCarrier.style.height = coverContentHeight + 'px'; 562 if (coverFilter) coverFilter.style.height = coverContentHeight + 'px'; 563 if (coverWrapper) coverWrapper.style.height = coverContentHeight + 'px'; 564 if (coverContainer) coverContainer.style.height = coverContentHeight + 'px'; 566 if (!window.isMobile) { 567 if (coverCarrier.querySelectorAll('iframe').length > 0) { 568 console.log('correct video from cover_fixcontentheight'); 569 t_form__onFuncLoad('setWidthAndHeightVideo', function () { 570 setWidthAndHeightVideo(coverCarrier, coverContentHeight + 'px', 'youtube'); 577 // Resize event refresh height and progress bar 578 function t_form__resize() { 579 t_form__calculateCoverHeight(); 581 t_form__checkFormWidth(); 585 // Resize popup height on step change 586 function t_form__resizePopupHeight(rec) { 587 var popupContainer = rec.querySelector('.t-popup__container'); 588 if (!popupContainer) return; 589 var popupContainerHeight = parseFloat(getComputedStyle(popupContainer, null).height.replace('px', '')); 591 var windowHeight = window.innerHeight - indent; 593 if (popupContainerHeight > windowHeight) { 594 popupContainer.classList.add('t-popup__container-static'); 596 popupContainer.classList.remove('t-popup__container-static'); 600 // Hide progress bar on 640 window width