Некодим© 2020-2026 Некодим
Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.
Журнал изменений История Git Файлы Tilda MCP Каталог файловtilda-tooltip-1.0.js Следить за файлом 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 История файла и сравнение версий t_addClass(self.tooltip, animation + '-show');
414 * Save call event transitionend for later removal after animation completes416 function animationEvent() {418 self.tooltip.removeEventListener('transitionend', animationEvent);421 self.tooltip.addEventListener('transitionend', animationEvent);423 self.tooltip.style.display = 'none';424 t_fadeIn(self.tooltip, self.options.speed, finish);427 // will check if our tooltip origin is removed while the tooltip is shown428 self._interval_set();430 // save call function431 var windowEvent = self.reposition.bind(self);433 self.windowEvents['scrollResize'] = windowEvent;435 window.addEventListener('scroll', windowEvent);436 window.addEventListener('resize', windowEvent);438 // auto-close bindings439 if (self.options.autoClose) {440 // in case a listener is already bound for autoclosing (mouse or touch, hover or click), unbind it first441 var documentEvent = self.documentEvents['touchClick'];444 body.removeEventListener('click', documentEvent);445 body.removeEventListener('touchstart', documentEvent);446 self.documentEvents['touchClick'] = '';449 // save call function450 documentEvent = self.hide.bind(self, '');451 self.documentEvents['touchClick'] = documentEvent;453 // here we'll have to set different sets of bindings for both touch and mouse454 if (self.options.trigger === 'hover') {455 // if the user touches the body, hide456 if (deviceHasTouchCapability) {457 // timeout 0 : explanation below in click section458 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 happen460 body.addEventListener('touchstart', documentEvent);464 // if we have to allow interaction465 if (self.options.interactive) {466 // touch events inside the tooltip must not close it467 if (deviceHasTouchCapability) {468 self.tooltip.addEventListener('touchstart', function (event) {469 event = event || window.event;470 event.stopPropagation();474 // as for mouse interaction, we get rid of the tooltip only after the mouse has spent some time out of it475 var tolerance = null;478 * Save call event mouseleave for later removal480 function elementProxyAcMouseLeave() {481 clearTimeout(tolerance);482 tolerance = setTimeout(function () {484 }, self.options.interactiveTolerance);488 * Save call event mouseenter for later removal490 function elementProxyAcMouseEnter() {491 clearTimeout(tolerance);494 var elementProxyAcMouseLeaveEvent = elementProxyAcMouseLeave.bind(self);495 var elementProxyAcMouseEnterEvent = elementProxyAcMouseEnter.bind(self);497 self.elementProxyEvents['mouseleaveac'] = elementProxyAcMouseLeaveEvent;498 self.elementProxyEvents['mouseenterac'] = elementProxyAcMouseEnterEvent;500 // hide after some time out of the proxy and the tooltip