Каталог файловtilda-step-form-1.0.js
401 var closeMarginTop = parseFloat(closeStyles.marginTop);402 var closeMarginBottom = parseFloat(closeStyles.marginBottom);403 if (!isNaN(closeMarginTop) && !isNaN(closeHeight)) closeHeight += closeMarginTop;404 if (!isNaN(closeMarginBottom) && !isNaN(closeHeight)) closeHeight += closeMarginBottom;405 topCoordinateForm = topCoordinateForm - closeHeight - 4;406 }407 }408 409 popup.scrollTop = topCoordinateForm;410 } else {411 // prettier-ignore412
История файла и сравнение версий
topCoordinateForm = rec.querySelector('.t-form__screen').getBoundingClientRect().top + window.pageYOffset - 150;
413 if (topCoordinateForm < window.scrollY) { 414 window.scrollTo(0, topCoordinateForm); 420 function t_form__calculateCoverHeight() { 421 var cover = rec.querySelector('.t-cover'); 422 var coverContent = rec.querySelector('div[data-hook-content]'); 423 var coverCarrier = rec.querySelector('.t-cover__carrier'); 425 // ничего не делаем, если блок без обложки 426 if (!cover || !coverContent || !coverCarrier) return; 428 var coverHeight = cover.offsetHeight; 429 var coverContentHeight = coverContent.offsetHeight; 430 var startHeight = coverCarrier.getAttribute('data-content-cover-height'); 433 if (startHeight.indexOf('px') !== -1) { 434 startHeight = parseInt(startHeight); 436 startHeight = window.innerHeight * (parseInt(startHeight) / 100); 440 if (coverContentHeight > 300) { 441 // FIXME: что за число 120? отступ сверху и снизу по 60? 442 coverContentHeight += 120; 444 if (coverContentHeight > 1000) { 445 // FIXME: что за число 100? дополнительный отступ сверху и снизу по 50? 446 coverContentHeight += 100; 449 if (coverContentHeight < startHeight) { 450 coverContentHeight = startHeight; 453 // обновляем высоту обложки, только если размер контента изменился. 454 if (coverHeight !== coverContentHeight) { 455 var coverFilter = rec.querySelector('.t-cover__filter'); 456 var coverWrapper = rec.querySelector('.t-cover__wrapper'); 457 var coverContainer = rec.querySelector('.t-cover__container'); 459 console.log('auto correct cover height: ' + coverContentHeight); 460 if (cover) cover.style.height = coverContentHeight + 'px'; 461 if (coverCarrier) coverCarrier.style.height = coverContentHeight + 'px'; 462 if (coverFilter) coverFilter.style.height = coverContentHeight + 'px'; 463 if (coverWrapper) coverWrapper.style.height = coverContentHeight + 'px'; 464 if (coverContainer) coverContainer.style.height = coverContentHeight + 'px'; 466 if (!window.isMobile) { 467 if (coverCarrier.querySelectorAll('iframe').length > 0) { 468 console.log('correct video from cover_fixcontentheight'); 469 t_form__onFuncLoad('setWidthAndHeightVideo', function () { 470 setWidthAndHeightVideo(coverCarrier, coverContentHeight + 'px', 'youtube'); 477 // Resize event refresh height and progress bar 478 function t_form__resize() { 479 t_form__calculateCoverHeight(); 481 t_form__checkFormWidth(); 485 // Resize popup height on step change 486 function t_form__resizePopupHeight(rec) { 487 var popupContainer = rec.querySelector('.t-popup__container'); 488 if (!popupContainer) return; 489 var popupContainerHeight = parseFloat(getComputedStyle(popupContainer, null).height.replace('px', '')); 491 var windowHeight = window.innerHeight - indent; 493 if (popupContainerHeight > windowHeight) { 494 popupContainer.classList.add('t-popup__container-static'); 496 popupContainer.classList.remove('t-popup__container-static'); 500 // Hide progress bar on 640 window width