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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-animation-sbs-1.0.js

Код файла
Версия от 05.12.2026, 07:01:09 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
401 * 2. если overflow: visible не задан, создаём специальный стиль, который задаёт402 *    overflow-x: hidden для родительской записи артборда с анимируемым по скроллу элементом.403 */404function t_animationSBS__processHorizontalScroll() {405	const scrollAnimationSelector = '[data-animate-sbs-event="scroll"]';406	const scrollingElements = Array.from(document.querySelectorAll(scrollAnimationSelector));407	if (!scrollingElements.length) return;408 409	const artboardsWithScrollingElements = scrollingElements.map(el => el.closest('.t396__artboard'));410	const hasOverflowVisible = artboardsWithScrollingElements.some(artboard => {411
История файла и сравнение версий
  • 05.12.2026, 07:01:09 · 56c3b845
const artBoardOverflow = artboard.getAttribute('data-artboard-ovrflw');
412 return ['visible', 'visibleX'].includes(artBoardOverflow);
413 });
414
415 if (hasOverflowVisible) {
416 t396__setOverflowToAllRecords();
417 } else {
418 t_animationSBS__generateOverflowStyles();
419 scrollingElements.forEach(fadeInLeftElement => {
420 const parentRecord = fadeInLeftElement.closest('.r');
421 parentRecord.classList.add('t-animation-sbs__overflow-x');
422 });
423 }
424}
425
426function t_animationSBS__generateOverflowStyles() {
427 if (document.getElementById('sbs-animation-block-overflow')) return;
428 const styles = document.createElement('style');
429 styles.id = 'sbs-animation-block-overflow';
430 styles.innerHTML = '.t-animation-sbs__overflow-x { overflow-x: hidden; }';
431 document.head.appendChild(styles);
432}
433
434/**
435 * as our script is async, we should wait, when zeroblock will be rendered.
436 * For new sites we can use artBoardRendered custom event, but for old - only setTimeout.
437 *
438 * @param {Function} callback
439 */
440function t_animationSBS__isZeroBlocksRendered(callback) {
441 var zeroArtBoards = t_animationSBS__getArtboards('396');
442 var aliasArtBoards = t_animationSBS__getArtboards('121');
443
444 var artBoards = [...zeroArtBoards, ...aliasArtBoards];
445 if (!artBoards.length) return;
446
447 var isTimerInited = false;
448 if (
449 artBoards.every(function (artboard) {
450 return artboard.classList.contains('rendered');
451 })
452 ) {
453 callback();
454 } else {
455 // check for old-version sites
456 // prettier-ignore
457 if (document.querySelectorAll('script[src*="tilda-blocks-2"], script[src*="tilda-blocks-1"]').length) {
458 t_animationSBS__backwardCompatibilityWait(artBoards, Date.now(), callback);
459 } else {
460 var renderedList = artBoards.filter(function (artboard) {
461 return artboard.classList.contains('rendered');
462 });
463 artBoards.forEach(function (artboard) {
464 if (artboard.classList.contains('rendered')) return;
465 artboard.addEventListener('artBoardRendered', function () {
466 renderedList.push(artboard);
467 if (renderedList.length === artBoards.length && !isTimerInited) callback();
468 });
469 });
470
471 // if by some reason all zero blocks can't be rendered (custom code),
472 // wait 3s and try to init animation script
473 setTimeout(function() {
474 isTimerInited = true;
475 if (renderedList.length === artBoards.length) return;
476 callback();
477 }, 3000);
478 }
479 }
480}
481
482/**
483 *
484 * @param {'396' | '121'} recType
485 * @returns {HTMLElement[]} - artboards
486 */
487function t_animationSBS__getArtboards(recType) {
488 const selector = `.r[data-record-type="${recType}"]:not(.t397__off, .t395__off, .t400__off) .t396__artboard, .r[data-parenttplid="${recType}"]:not(.t397__off, .t395__off, .t400__off) .t396__artboard`;
489 return Array.from(document.querySelectorAll(selector));
490}
491
492function t_animationSBS__backwardCompatibilityWait(artBoards, time, callback) {
493 if (
494 artBoards.every(function (artboard) {
495 return artboard.classList.contains('rendered');
496 })
497 ) {
498 callback();
499 } else {
500 if (Date.now() - time > 10000) {
Предыдущие 100 строкСледующие 100 строк