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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-animation-2.0.js

Код файла
Версия от 04.12.2026, 04:03:53 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
601		var screens = artBoard.getAttribute('data-artboard-screens');602		screens = screens ? screens.split(',') : [1200, 960, 640, 480, 320];603 604		screens = screens.map(function (screen) {605			return parseInt(screen, 10);606		});607 608		var difference = screens.filter(function (screen) {609			return breakpoints.indexOf(screen) === -1;610		});611 612		breakpoints = breakpoints.concat(difference);
История файла и сравнение версий
  • 04.12.2026, 04:03:53 · 56c3b845
613 });
614
615 breakpoints = t_animate__sortArr(breakpoints);
616 return breakpoints;
617}
618
619/**
620 * get correct string of CSS @media-query for generated styles of animated elements in Zero Block
621 *
622 * @returns {Object}
623 */
624function t_animate__getMediaQuery(breakpoints, index) {
625 var text = '';
626 var isContinue = false;
627
628 var minRes = breakpoints[index + 1];
629 var maxRes = breakpoints[index] - 1;
630
631 var lastBreakpoint = index === breakpoints.length - 1;
632 var preLastBreakpoint = index === breakpoints.length - 2;
633
634 if (lastBreakpoint) {
635 isContinue = true;
636 } else if (preLastBreakpoint) {
637 text += '@media screen and (max-width: ' + maxRes + 'px) {';
638 } else {
639 text += '@media screen and (min-width: ' + minRes + 'px) and (max-width: ' + maxRes + 'px) {';
640 }
641
642 return { text, isContinue, minRes };
643}
644
645/**
646 * sorting an array of breakpoints from large to small
647 *
648 * @param {Array} breakpoints - unsorted array of breakpoints
649 * @returns {Array} soritized array of breakpoints
650 */
651function t_animate__sortArr(breakpoints) {
652 return breakpoints.sort(function (a, b) {
653 return b - a;
654 });
655}
656
657/**
658 * Start animation
659 *
660 * @returns {void} - if some elements cannot find
661 */
662function t_animate__startAnimation() {
663 var records = document.querySelectorAll('.r');
664
665 // animGroupsBlocks contains connected elements, which animation starts at the same time
666 var animGroupsBlocks = Array.prototype.filter.call(records, function (record) {
667 return record.querySelector('.t-animate[data-animate-group=yes]');
668 });
669
670 // animChainsBlocks contains elements, which are animated as a chain, row by row
671 var animChainsBlocks = Array.prototype.filter.call(records, function (record) {
672 return record.querySelector('.t-animate[data-animate-chain="yes"]');
673 });
674
675 // animElems contains independent single elements
676 var animElems = document.querySelectorAll('.t-animate');
677 animElems = Array.prototype.filter.call(animElems, function (animEl) {
678 return (
679 !(
680 animEl.getAttribute('data-animate-group') === 'yes' ||
681 animEl.getAttribute('data-animate-chain') === 'yes'
682 ) && !animEl.getAttribute('observer-ready')
683 );
684 });
685
686 // upgrade list of animated blocks because of mobile resolution
687 if (window.innerWidth < 1200) {
688 animGroupsBlocks = t_animate__checkMobile(animGroupsBlocks);
689 animChainsBlocks = t_animate__checkMobile(animChainsBlocks);
690 animElems = t_animate__checkMobile(animElems);
691 }
692 // if there is no more blocks than quit
693 if (!animGroupsBlocks.length && !animElems.length && !animChainsBlocks.length) {
694 return;
695 }
696
697 // set state to all groups
698 t_animate__setAnimationState(animGroupsBlocks, animChainsBlocks, animElems);
699
700 animGroupsBlocks = t_animate__hasWaitAnimation(animGroupsBlocks);
Предыдущие 100 строкСледующие 100 строк