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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-tooltip-1.0.js

Код файла
Версия от 18.08.2026, 07:00:16 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
401						// attach402						body.appendChild(self.tooltip);403 404						// do all the crazy calculations and positioning405						self.reposition();406 407						// call our custom callback since the content of the tooltip is now part of the DOM408						self.options.functionReady.call(self.element, self.element, self.tooltip);409 410						// animate in the tooltip411						if (supportsTransitions()) {412
История файла и сравнение версий
  • 18.08.2026, 07:00:16 · 56c3b845
t_addClass(self.tooltip, animation + '-show');
413 /**
414 * Save call event transitionend for later removal after animation completes
415 */
416 function animationEvent() {
417 finish();
418 self.tooltip.removeEventListener('transitionend', animationEvent);
419 }
420
421 self.tooltip.addEventListener('transitionend', animationEvent);
422 } else {
423 self.tooltip.style.display = 'none';
424 t_fadeIn(self.tooltip, self.options.speed, finish);
425 }
426
427 // will check if our tooltip origin is removed while the tooltip is shown
428 self._interval_set();
429
430 // save call function
431 var windowEvent = self.reposition.bind(self);
432
433 self.windowEvents['scrollResize'] = windowEvent;
434
435 window.addEventListener('scroll', windowEvent);
436 window.addEventListener('resize', windowEvent);
437
438 // auto-close bindings
439 if (self.options.autoClose) {
440 // in case a listener is already bound for autoclosing (mouse or touch, hover or click), unbind it first
441 var documentEvent = self.documentEvents['touchClick'];
442
443 if (documentEvent) {
444 body.removeEventListener('click', documentEvent);
445 body.removeEventListener('touchstart', documentEvent);
446 self.documentEvents['touchClick'] = '';
447 }
448
449 // save call function
450 documentEvent = self.hide.bind(self, '');
451 self.documentEvents['touchClick'] = documentEvent;
452
453 // here we'll have to set different sets of bindings for both touch and mouse
454 if (self.options.trigger === 'hover') {
455 // if the user touches the body, hide
456 if (deviceHasTouchCapability) {
457 // timeout 0 : explanation below in click section
458 setTimeout(function () {
459 // we don't want to bind on click here because the initial touchstart event has not yet triggered its click event, which is thus about to happen
460 body.addEventListener('touchstart', documentEvent);
461 }, 0);
462 }
463
464 // if we have to allow interaction
465 if (self.options.interactive) {
466 // touch events inside the tooltip must not close it
467 if (deviceHasTouchCapability) {
468 self.tooltip.addEventListener('touchstart', function (event) {
469 event = event || window.event;
470 event.stopPropagation();
471 });
472 }
473
474 // as for mouse interaction, we get rid of the tooltip only after the mouse has spent some time out of it
475 var tolerance = null;
476
477 /**
478 * Save call event mouseleave for later removal
479 */
480 function elementProxyAcMouseLeave() {
481 clearTimeout(tolerance);
482 tolerance = setTimeout(function () {
483 self.hide();
484 }, self.options.interactiveTolerance);
485 }
486
487 /**
488 * Save call event mouseenter for later removal
489 */
490 function elementProxyAcMouseEnter() {
491 clearTimeout(tolerance);
492 }
493
494 var elementProxyAcMouseLeaveEvent = elementProxyAcMouseLeave.bind(self);
495 var elementProxyAcMouseEnterEvent = elementProxyAcMouseEnter.bind(self);
496
497 self.elementProxyEvents['mouseleaveac'] = elementProxyAcMouseLeaveEvent;
498 self.elementProxyEvents['mouseenterac'] = elementProxyAcMouseEnterEvent;
499
500 // hide after some time out of the proxy and the tooltip
Предыдущие 100 строкСледующие 100 строк