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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-animation-2.0.js

Код файла
Версия от 04.12.2026, 04:03:53 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1901		// remove 0s transition duration1902		curElem.style.transitionDuration = '';1903		curElem.style.transitionDelay = '';1904	}1905	// detect element delay1906	var curElemDelay = t_animate__getAttrByResBase(curElem, 'delay');1907	if (curElemDelay) {1908		curElem.style.transitionDelay = curElemDelay + 's';1909	}1910	// detect element transirtion duration1911	var curElemDuration = t_animate__getAttrByResBase(curElem, 'duration');1912
История файла и сравнение версий
  • 04.12.2026, 04:03:53 · 56c3b845
if (curElemDuration) {
1913 curElem.style.transitionDuration = curElemDuration + 's';
1914 }
1915}
1916
1917/**
1918 * Remove inline animated styles for ZB elements in screen < 980px
1919 */
1920function t_animate__removeInlineAnimStyles() {
1921 if (window.innerWidth < 980) {
1922 var animatedElements = document.querySelectorAll('.t396__elem.t-animate:not(.t-animate_wait)');
1923 Array.prototype.forEach.call(animatedElements, function (animatedElement) {
1924 animatedElement.style.transform = '';
1925 animatedElement.style.transitionDuration = '';
1926 animatedElement.style.transitionDelay = '';
1927 });
1928 }
1929}
1930
1931/**
1932 * Force repaint element
1933 *
1934 * @param {HTMLElement} curElem - current element
1935 * @param {number} curElemOffsetTop - number of offset
1936 * @param {number} viewBottom - number of offset
1937 */
1938function t_animate__forceElemInViewPortRepaint(curElem, curElemOffsetTop, viewBottom) {
1939 if (curElem && curElemOffsetTop < viewBottom + 500) {
1940 curElem.offsetHeight;
1941 }
1942}
1943
1944/**
1945 * Calculate trigger offset for animElems group
1946 * @param {HTMLElement} curElem - current element
1947 * @param {number} viewBottom - bottom position of viewport
1948 * @returns {number} - curElemTrigger - difference between viewBottom and current el offset top
1949 */
1950function t_animate__detectElemTriggerOffset(curElem, viewBottom) {
1951 var curElemTriggerOffset = t_animate__getAttrByResBase(curElem, 'trigger-offset');
1952 var curElemTrigger = viewBottom;
1953 if (curElemTriggerOffset) {
1954 curElemTriggerOffset = curElemTriggerOffset.replace('px', '');
1955 curElemTrigger = viewBottom - curElemTriggerOffset * 1;
1956 }
1957 return curElemTrigger;
1958}
1959
1960/**
1961 * Set attributes for title and description to save
1962 * animation start time (to set right delay for chain items)
1963 *
1964 * @param {HTMLElement} curBlock - current block
1965 */
1966function t_animate__saveSectionHeaderStartTime(curBlock) {
1967 var sectionTitle = curBlock.querySelectorAll('.t-section__title.t-animate');
1968 var sectionDescr = curBlock.querySelectorAll('.t-section__descr.t-animate');
1969 if (sectionTitle.length) {
1970 Array.prototype.forEach.call(sectionTitle, function (title) {
1971 title.setAttribute('data-animate-start-time', Date.now());
1972 });
1973 }
1974 if (sectionDescr.length) {
1975 Array.prototype.forEach.call(sectionDescr, function (descr) {
1976 descr.setAttribute('data-animate-start-time', Date.now() + 160);
1977 });
1978 }
1979}
1980
1981/**
1982 * Add section head delay if current block has animated title or descr
1983 *
1984 * @param {HTMLElement} curBlock - current block
1985 * @returns {number} - of sectionHeadDelay
1986 */
1987function t_animate__getCurBlockSectionHeadDelay(curBlock) {
1988 var sectionHeadDelay = 0;
1989 if (curBlock.querySelectorAll('.t-section__title.t-animate').length) {
1990 sectionHeadDelay += 0.16;
1991 }
1992 if (curBlock.querySelectorAll('.t-section__descr.t-animate').length) {
1993 sectionHeadDelay += 0.16;
1994 }
1995 return sectionHeadDelay;
1996}
1997
1998/**
1999 * Add wait class to btn if it is a part of chain animation
2000 * @param {HTMLElement} curBlock - block contains [data-animate-chain=yes]
Предыдущие 100 строкСледующие 100 строк