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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-menu-1.0.js

Код файла
Версия от 18.08.2026, 07:00:17 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
401		} else {402			var mobileBurger = mobileMenu.querySelector('.t-menuburger');403			mobileMenu.addEventListener('click', function (event) {404				if (event.target.closest('a')) {405					return;406				}407 408				if (mobileMenu.classList.contains(mobileMenuOpenClass)) {409					t_menu__FadeOut(menu, 300);410					mobileMenu.classList.remove(mobileMenuOpenClass);411					mobileBurger.classList.remove(burgerOpenClass);412
История файла и сравнение версий
  • 18.08.2026, 07:00:17 · 56c3b845
mobileBurger.setAttribute('aria-expanded', 'false');
413 } else {
414 t_menu__fadeIn(menu, 300, function () {
415 if (menu.style.transform) menu.style.transform = '';
416 if (menu.style.opacity) menu.style.opacity = '';
417 });
418 mobileMenu.classList.add(mobileMenuOpenClass);
419 mobileBurger.classList.add(burgerOpenClass);
420 mobileBurger.setAttribute('aria-expanded', 'true');
421 if (menu.classList.contains('tmenu-mobile__menucontent_fixed')) {
422 var burgerHeight = getComputedStyle(mobileMenu).height;
423 var burgerBorderSize = getComputedStyle(mobileMenu).borderBottom || 0;
424 menu.style.top = burgerHeight + burgerBorderSize;
425 }
426 }
427 t_menu_checkOverflow(recid, selector);
428 });
429 }
430 }
431
432 if (screen.width < 980) {
433 rec.addEventListener('click', function (e) {
434 if (!menu || !menu.classList.contains('tmenu-mobile__menucontent_fixed')) return;
435 const menuHeadNode = menu.closest('.r')?.querySelector('.tmenu-mobile_positionfixed');
436 const menuHeadHeight = menuHeadNode?.offsetHeight || 0;
437 if (menuHeadHeight) menu.style.top = menuHeadHeight + 'px';
438 // prettier-ignore
439 var menuLink = e.target.closest('.t-menu__link-item, .t978__submenu-link, .t978__innermenu-link, .t966__menu-link, .t-menusub__link-item, .t-btn, .t794__link');
440 if (!menuLink) return;
441 var submenuClassList = [
442 't978__menu-link_hook',
443 't978__tm-link',
444 't966__tm-link',
445 't794__tm-link',
446 't-menusub__target-link',
447 ];
448 var isSubmenuHook = submenuClassList.some(function (submenuClass) {
449 return menuLink.classList.contains(submenuClass);
450 });
451 if (isSubmenuHook) {
452 menu.addEventListener('menuOverflow', function () {
453 t_menu_checkOverflow(recid, selector);
454 });
455 return;
456 }
457 t_menu__FadeOut(menu, 300);
458 if (mobileMenu) mobileMenu.classList.remove(mobileMenuOpenClass);
459 if (mobileMenu) mobileBurger.classList.remove(burgerOpenClass);
460 });
461 }
462
463 window.addEventListener(
464 'resize',
465 t_throttle(function () {
466 if (window.innerWidth > 980) {
467 if (menu) menu.style.opacity = '';
468 if (menu) menu.style.display = '';
469 if (menu) {
470 const customTopPosition = menu.getAttribute('data-top') || '';
471 menu.style.top = customTopPosition;
472 }
473 if (mobileMenu) mobileMenu.classList.remove(mobileMenuOpenClass);
474 }
475 t_menu_checkOverflow(recid, selector);
476 }, 200)
477 );
478}
479
480function t_menu_checkOverflow(recid, selector) {
481 var rec = document.getElementById('rec' + recid);
482 var menu = rec ? rec.querySelector(selector) : null;
483 if (!menu) return;
484 var oldMobileMenuSelector = rec.querySelector(selector + '__mobile');
485 var burger = oldMobileMenuSelector ? oldMobileMenuSelector : rec.querySelector('.tmenu-mobile');
486 if (!burger) return;
487 var burgerHeight = burger.offsetHeight;
488
489 var windowHeight = document.documentElement.clientHeight;
490 var menuPosition = menu.style.position || window.getComputedStyle(menu).position;
491 var menuHeight = menu.offsetHeight;
492
493 if (menuPosition === 'fixed' && menuHeight > windowHeight - burgerHeight) {
494 menu.style.overflow = 'auto';
495 menu.style.maxHeight = 'calc(100% - ' + burgerHeight + 'px' + ')';
496 }
497}
498
499function t_menu__FadeOut(element, duration, callback) {
500 if (!element) return false;
Предыдущие 100 строкСледующие 100 строк