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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-menu-1.1.js

Код файла
Версия от 18.08.2026, 07:00:17 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
501 502	t_menuBase_updateMobileMenuTop(rec);503 504	window.addEventListener(505		'resize',506		t_throttle(function () {507			t_menuBase_updateMobileMenuTop(rec);508		}, 200)509	);510 511	// Высота плашки меню зависит от размера бургера512	// Поэтому требуется персчет координаты top для контейнера меню513
История файла и сравнение версий
  • 18.08.2026, 07:00:17 · 56c3b845
function t_menuBase_updateMobileMenuTop(rec) {
514 const mobileFixedMenu = rec.querySelector('.tmenu-mobile.tmenu-mobile_positionfixed');
515 const mobileMenu = rec.querySelector('.tmenu-mobile__menucontent_fixed');
516 if (!mobileFixedMenu || !mobileMenu) return;
517
518 if (window.innerWidth <= 960) {
519 const computedStyle = window.getComputedStyle(mobileFixedMenu);
520 const baseMobileMenuHeight = 64;
521 const height = parseFloat(computedStyle.height) || baseMobileMenuHeight;
522 const borderBottom = parseFloat(computedStyle.borderBottomWidth) || 0;
523 const top = height + borderBottom;
524
525 mobileMenu.style.setProperty('top', top + 'px', 'important');
526 } else {
527 mobileMenu.style.setProperty('top', '0px');
528 }
529 }
530}
531
532function t_menuBase__checkOverflow(recid, selector) {
533 var rec = document.getElementById('rec' + recid);
534 var menu = rec ? rec.querySelector(selector) : null;
535 if (!menu) return;
536 var oldMobileMenuSelector = rec.querySelector(selector + '__mobile');
537 var burger = oldMobileMenuSelector ? oldMobileMenuSelector : rec.querySelector('.tmenu-mobile');
538 if (!burger) return;
539 var burgerHeight = burger.offsetHeight;
540
541 var windowHeight = document.documentElement.clientHeight;
542 var menuPosition = menu.style.position || window.getComputedStyle(menu).position;
543 var menuHeight = menu.offsetHeight;
544
545 if (menuPosition === 'fixed' && menuHeight > windowHeight - burgerHeight) {
546 var availableHeight = windowHeight - burgerHeight * 2;
547 menu.style.overflow = 'auto';
548 menu.style.maxHeight = availableHeight + 'px';
549 }
550}
551
552function t_menuBase__FadeOut(element, duration, callback) {
553 if (!element) return false;
554 var opacity = 1;
555 duration = parseInt(duration, 10);
556 var speed = duration > 0 ? duration / 10 : 40;
557 var timer = setInterval(function () {
558 element.style.opacity = opacity;
559 opacity -= 0.1;
560 if (opacity <= 0.1) {
561 element.style.opacity = '0';
562 element.style.display = 'none';
563 if (typeof callback === 'function') {
564 callback();
565 }
566 clearInterval(timer);
567 }
568 }, speed);
569}
570
571function t_menuBase__fadeIn(element, duration, callback) {
572 if (!element) return false;
573 if (
574 (getComputedStyle(element).opacity === '1' || getComputedStyle(element).opacity === '') &&
575 getComputedStyle(element).display !== 'none'
576 )
577 return false;
578 var opacity = 0;
579 duration = parseInt(duration, 10);
580 var speed = duration > 0 ? duration / 10 : 40;
581 element.style.opacity = opacity;
582 element.style.display = 'block';
583 var timer = setInterval(function () {
584 element.style.opacity = opacity;
585 opacity += 0.1;
586 if (opacity >= 1) {
587 element.style.opacity = '1';
588 if (typeof callback === 'function') {
589 callback();
590 }
591 clearInterval(timer);
592 }
593 }, speed);
594}
595
596function t_menuBase__slideElement(menu, menuHeight, direction) {
597 var diff = direction === 'toTop' ? 0 : menuHeight;
598 var diffOpacity = direction === 'toTop' ? 1 : 0;
599 var timerID = setInterval(function () {
600 menu.style.transform = 'translateY(-' + diff + 'px)';
Предыдущие 100 строкСледующие 100 строк