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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-animation-2.0.js

Код файла
Версия от 04.12.2026, 04:03:53 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
901				})902			);903		}904	});905}906 907/* ---------- functions, which do all animation work on scroll ---------- */908 909/**910 * Animate on scroll. Called if IntersectionObserver is undefined911 *912 * @param {HTMLElement[]} animGroupsBlocks - list of animated group blocks913
История файла и сравнение версий
  • 04.12.2026, 04:03:53 · 56c3b845
* @param {HTMLElement[]} animChainsBlocks - list of animated chain blocks
914 * @param {HTMLElement[]} animElems - list of animated elements
915 * @returns {void}
916 */
917function t_animate__animateOnScroll(animGroupsBlocks, animChainsBlocks, animElems) {
918 if (!animGroupsBlocks.length && !animChainsBlocks.length && !animElems.length) return;
919 var viewTop = window.pageYOffset;
920 var viewBottom = viewTop + window.innerHeight;
921 var newAnimGroupsBlocks = t_animate__animateGroups(animGroupsBlocks, viewBottom, viewTop);
922 var newAnimChainsBlocks = t_animate__animateChainsBlocks(animChainsBlocks, viewBottom, viewTop);
923 var newAnimElems = t_animate__animateElems(animElems, viewBottom, viewTop);
924 return [newAnimGroupsBlocks, newAnimChainsBlocks, newAnimElems];
925}
926
927/**
928 * Animate grouped blocks. Called inside t_animate__animateOnScroll
929 *
930 * @param {HTMLElement[]} animGroupsBlocks - list of animated group blocks
931 * @param {number} viewBottom - bottom position of viewport
932 */
933function t_animate__animateGroups(animGroupsBlocks, viewBottom) {
934 animGroupsBlocks.forEach(function (currentBlock) {
935 if (currentBlock.curTopOffset < viewBottom) {
936 var currentBlockEls = currentBlock.querySelectorAll('.t-animate');
937 currentBlockEls = Array.prototype.filter.call(currentBlockEls, function (el) {
938 return !(
939 el.classList.contains('t-animate__btn-wait-chain') ||
940 el.getAttribute('data-animate-chain') === 'yes'
941 );
942 });
943 t_animate__makeSectionButtonWait(currentBlock);
944 t_animate__saveSectionHeaderStartTime(currentBlock);
945 Array.prototype.forEach.call(currentBlockEls, function (currentBlockEl) {
946 currentBlockEl.classList.remove('t-animate_wait');
947 t_animate__removeNoHoverClassFromBtns(currentBlockEl);
948 t_animate__startElementAnimation(currentBlockEl, false);
949 });
950 }
951 });
952
953 return animGroupsBlocks;
954}
955
956/**
957 * Animate chain blocks
958 * @param {HTMLElement[]} animChainsBlocks - list of animation chain blocks
959 * @param {number} viewBottom - bottom position of viewport
960 */
961function t_animate__animateChainsBlocks(animChainsBlocks, viewBottom) {
962 animChainsBlocks.forEach(function (curBlock) {
963 if (curBlock.itemsOffsets[0] < viewBottom && curBlock.querySelectorAll('.t-animate_wait').length) {
964 t_animate__animateChainItemsOnScroll(curBlock, viewBottom);
965 if (curBlock.itemsOffsets.length) {
966 t_animate__checkSectionButtonAnimation__outOfTurn(curBlock);
967 }
968 }
969 });
970
971 return animChainsBlocks;
972}
973
974/**
975 * Animate common elements. Called inside t_animate__animateOnScroll
976 *
977 * @param {HTMLElement[]} animElems - list of animated elements
978 * @param {number} viewBottom - bottom position of viewport
979 */
980function t_animate__animateElems(animElems, viewBottom, viewTop) {
981 Array.prototype.filter.call(animElems, function (el) {
982 var curElemTrigger = t_animate__detectElemTriggerOffset(el, viewBottom);
983 if (el.curTopOffset < curElemTrigger) {
984 el.classList.remove('t-animate_wait');
985 t_animate__removeNoHoverClassFromBtns(el);
986 t_animate__startElementAnimation(el, false);
987 if (t_animate__getAttrByResBase(el, 'style') === 'animatednumber') {
988 t_animate__animateNumbers(el);
989 }
990 return true;
991 }
992
993 if (el.curTopOffset < viewTop) {
994 return false;
995 }
996 });
997
998 return animElems;
999}
1000
Предыдущие 100 строкСледующие 100 строк