Некодим логотипНекодим
МодификацииПубликацииНекодИИмЦены
Некодим логотипНекодим

© 2020-2026 Некодим

Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.

Компания

  • Контакты
  • Публичная оферта
  • Политика конфиденциальности
  • Согласие на обработку данных
  • Лицензионное соглашение
  • Реферальная программа

Полезное

  • Модификации
  • Публикации
  • Каталог блоков Tilda
  • MCP для агентов
  • Журнал изменений
  • Доска почёта

Личный кабинет

  • Вход
  • Регистрация
  • Цены
Журнал измененийИстория GitФайлыTilda MCP
Каталог файлов

tilda-animation-2.0.js

Код файла
Версия от 04.12.2026, 04:03:53 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
2001 */2002function t_animate__makeSectionButtonWait(curBlock) {2003	var chainLength = curBlock.querySelectorAll('.t-animate[data-animate-chain=yes]').length;2004	var sectionBtn = curBlock.querySelectorAll('.t-section__bottomwrapper .t-btn.t-animate');2005	if (chainLength.length && sectionBtn.length) {2006		Array.prototype.forEach.call(sectionBtn, function (btn) {2007			btn.classList.add('t-animate__btn-wait-chain');2008		});2009	}2010}2011 2012
История файла и сравнение версий
  • 04.12.2026, 04:03:53 · 56c3b845
/**
2013 * Add animation to btn if it has t-animate__btn-wait-chain
2014 *
2015 * @param {HTMLElement} curBlock - block contains animated btn
2016 * @param {number} curItemDelay - current delay
2017 */
2018function t_animate__checkSectionButtonAnimation(curBlock, curItemDelay) {
2019 var chainBtn = curBlock.querySelectorAll('.t-animate__btn-wait-chain');
2020 if (chainBtn.length) {
2021 Array.prototype.forEach.call(chainBtn, function (btn) {
2022 btn.style.transitionDelay = curItemDelay + 0.16 + 's';
2023 t_animate__removeNoHoverClassFromBtns(btn);
2024 btn.classList.remove('t-animate__btn-wait-chain');
2025 t_animate__startElementAnimation(btn, false);
2026 });
2027 }
2028}
2029
2030/**
2031 * Add chainDelay if current block not contains chain items
2032 *
2033 * @param {HTMLElement} curBlock - current block
2034 */
2035function t_animate__checkSectionButtonAnimation__outOfTurn(curBlock) {
2036 var waitingChainItems = curBlock.querySelectorAll('.t-animate[data-animate-chain=yes]');
2037 waitingChainItems = Array.prototype.filter.call(waitingChainItems, function (chain) {
2038 return !chain.classList.contains('t-animate_started');
2039 });
2040 if (!waitingChainItems.length) {
2041 var chainDelay = 0.16;
2042 t_animate__checkSectionButtonAnimation(curBlock, chainDelay);
2043 }
2044}
2045
2046/**
2047 * Add no-hover class to btn
2048 */
2049function t_animate__addNoHoverClassToBtns() {
2050 var animatedBtns = document.querySelectorAll('.t-btn.t-animate');
2051 Array.prototype.forEach.call(animatedBtns, function (btn) {
2052 btn.classList.add('t-animate_no-hover');
2053 });
2054}
2055
2056/**
2057 * Add event to .t-btn on transitionend after which remove transition-delay&transition-duration and t-animate_no-hover class
2058 *
2059 * @param {HTMLElement} curBlockAnimElem - current el
2060 * @returns {false} - if current el is not defined
2061 */
2062function t_animate__removeNoHoverClassFromBtns(curBlockAnimElem) {
2063 if (!curBlockAnimElem) return false;
2064 var currentBtn = curBlockAnimElem.classList.contains('t-btn') ? curBlockAnimElem : null;
2065 if (currentBtn) {
2066 currentBtn.ontransitionend = function (e) {
2067 if (e.propertyName === 'opacity' || e.propertyName === 'transform') {
2068 currentBtn.classList.remove('t-animate_no-hover');
2069 currentBtn.style.transitionDelay = '';
2070 currentBtn.style.transitionDuration = '';
2071 this.ontransitionend = null;
2072 }
2073 };
2074 }
2075}
2076
2077/**
2078 * For group animation add equal offset (curTopOffset)
2079 *
2080 * @param {HTMLElement[]} animGroupsBlocks - animated group block list
2081 */
2082function t_animate__getGroupsOffsets(animGroupsBlocks) {
2083 animGroupsBlocks.forEach(function (animGroupsBlock) {
2084 var animatedChild = animGroupsBlock.querySelector('.t-animate');
2085 if (animatedChild) {
2086 animGroupsBlock.curTopOffset = animatedChild.getBoundingClientRect().top + window.pageYOffset;
2087 var zoom = t_animation__getZoom(animGroupsBlock);
2088 if (!window.isOnlyScalable) animGroupsBlock.curTopOffset *= zoom;
2089 }
2090 });
2091}
2092
2093function t_animation__getZoom(el) {
2094 if (typeof el.scaleFactor !== 'undefined') return el.scaleFactor;
2095 var artboard = el.closest('.t396__artboard');
2096 if (!artboard) return 1;
2097 var isOldPage = document.querySelector('script[src*="tilda-blocks-2.7"]');
2098 if (
2099 artboard.classList.contains('t396__artboard_scale') ||
2100 (!isOldPage &&
Предыдущие 100 строкСледующие 100 строк