Некодим© 2020-2026 Некодим
Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.
Журнал изменений История Git Файлы Tilda MCP Каталог файловtilda-faq-1.0.js Следить за файлом 1 2 function t_faq_init(recId) {3 var rec = document.getElementById('rec' + recId);4 if (!rec) return;5 6 var togglers = rec.querySelectorAll('.t_faq__header');7 var isLazy = document.getElementById('allrecords').getAttribute('data-tilda-lazy');8 var accordion = rec.querySelector('.t_faq__accordion');9 var cachedHeight = 0;10 var cachedTop = 0;11 12 if (accordion) {История файла и сравнение версий accordion = accordion.getAttribute('data-accordion');
18 Array.prototype.forEach.call(togglers, function (toggler) {19 toggler.addEventListener('click', function () {21 var content = target.nextElementSibling;22 var triggerButton = target.querySelector('.t_faq__trigger-button');24 if (accordion === 'true') {25 Array.prototype.forEach.call(togglers, function (header) {26 if (target !== header) {27 header.classList.remove('t_faq__header_opened');28 t_faq_slideUp(header.nextElementSibling, target);34 var isExpanded = triggerButton.getAttribute('aria-expanded') === 'true';35 triggerButton.setAttribute('aria-expanded', !isExpanded);36 content.hidden = isExpanded;39 target.classList.toggle('t_faq__header_opened');40 target.style.pointerEvents = 'none';41 t_faq_slideToggle(target.nextElementSibling, target);43 if (window.lazy === 'y' || isLazy === 'yes') {44 t_onFuncLoad('t_lazyload_update', function () {51 function t_faq_slideToggle(target, triggerElement, duration) {53 if (!duration && duration !== 0) duration = 300;55 if (window.getComputedStyle(target).display === 'none') {56 t_faq_slideDown(target, triggerElement, duration);59 t_faq_slideUp(target, triggerElement, duration);63 function t_faq_slideUp(target, triggerElement, duration) {65 if (!duration && duration !== 0) duration = 300;66 target.style.transitionProperty = 'height, margin, padding';67 target.style.transitionDuration = duration + 'ms';68 target.style.boxSizing = 'border-box';69 target.style.height = target.offsetHeight + 'px';71 target.style.overflow = 'hidden';72 target.style.height = '0';73 target.style.paddingTop = '0';74 target.style.paddingBottom = '0';75 target.style.marginTop = '0';76 target.style.marginBottom = '0';77 setTimeout(function () {78 triggerElement.style.pointerEvents = 'auto';79 target.style.display = 'none';80 target.style.height = '';81 target.style.paddingTop = '';82 target.style.paddingBottom = '';83 target.style.marginTop = '';84 target.style.marginBottom = '';85 target.style.overflow = '';86 target.style.transitionDuration = '';87 target.style.transitionProperty = '';91 function t_faq_slideDown(target, triggerElement, duration) {93 if (!duration && duration !== 0) duration = 300;94 target.style.display = '';95 var cashedDisplay = window.getComputedStyle(target).display;96 if (cashedDisplay === 'none') cashedDisplay = 'block';97 target.style.display = cashedDisplay;98 var targetHeight = target.offsetHeight;99 var targetTop = target.offsetTop;100 if (window.visualViewport){