1901// remove 0s transition duration1902curElem.style.transitionDuration = '';1903curElem.style.transitionDelay = '';1904}1905// detect element delay1906var curElemDelay = t_animate__getAttrByResBase(curElem, 'delay');1907if (curElemDelay) {1908curElem.style.transitionDelay = curElemDelay + 's';1909}1910// detect element transirtion duration1911var curElemDuration = t_animate__getAttrByResBase(curElem, 'duration');1912
if (curElemDuration) { curElem.style.transitionDuration = curElemDuration + 's'; }}/** * Remove inline animated styles for ZB elements in screen < 980px */function t_animate__removeInlineAnimStyles() { if (window.innerWidth < 980) { var animatedElements = document.querySelectorAll('.t396__elem.t-animate:not(.t-animate_wait)'); Array.prototype.forEach.call(animatedElements, function (animatedElement) { animatedElement.style.transform = ''; animatedElement.style.transitionDuration = ''; animatedElement.style.transitionDelay = ''; }); }}/** * Force repaint element * * @param {HTMLElement} curElem - current element * @param {number} curElemOffsetTop - number of offset * @param {number} viewBottom - number of offset */function t_animate__forceElemInViewPortRepaint(curElem, curElemOffsetTop, viewBottom) { if (curElem && curElemOffsetTop < viewBottom + 500) { curElem.offsetHeight; }}/** * Calculate trigger offset for animElems group * @param {HTMLElement} curElem - current element * @param {number} viewBottom - bottom position of viewport * @returns {number} - curElemTrigger - difference between viewBottom and current el offset top */function t_animate__detectElemTriggerOffset(curElem, viewBottom) { var curElemTriggerOffset = t_animate__getAttrByResBase(curElem, 'trigger-offset'); var curElemTrigger = viewBottom; if (curElemTriggerOffset) { curElemTriggerOffset = curElemTriggerOffset.replace('px', ''); curElemTrigger = viewBottom - curElemTriggerOffset * 1; } return curElemTrigger;}/** * Set attributes for title and description to save * animation start time (to set right delay for chain items) * * @param {HTMLElement} curBlock - current block */function t_animate__saveSectionHeaderStartTime(curBlock) { var sectionTitle = curBlock.querySelectorAll('.t-section__title.t-animate'); var sectionDescr = curBlock.querySelectorAll('.t-section__descr.t-animate'); if (sectionTitle.length) { Array.prototype.forEach.call(sectionTitle, function (title) { title.setAttribute('data-animate-start-time', Date.now()); }); } if (sectionDescr.length) { Array.prototype.forEach.call(sectionDescr, function (descr) { descr.setAttribute('data-animate-start-time', Date.now() + 160); }); }}/** * Add section head delay if current block has animated title or descr * * @param {HTMLElement} curBlock - current block * @returns {number} - of sectionHeadDelay */function t_animate__getCurBlockSectionHeadDelay(curBlock) { var sectionHeadDelay = 0; if (curBlock.querySelectorAll('.t-section__title.t-animate').length) { sectionHeadDelay += 0.16; } if (curBlock.querySelectorAll('.t-section__descr.t-animate').length) { sectionHeadDelay += 0.16; } return sectionHeadDelay;}/** * Add wait class to btn if it is a part of chain animation * @param {HTMLElement} curBlock - block contains [data-animate-chain=yes]