Каталог файловtilda-zero-tooltip-1.1.js
601 t396_tooltip__updateTooltipOnImageResize(image, handleResize);602 }603 604 artboard.addEventListener('artBoardResized', handleResize, { passive: true });605 606 startContinuousTracking();607 608 return function cleanup() {609 stopContinuousTracking();610 clearTimeout(inactivityTimerId);611 612 scrollListeners.forEach(({ container, listener }) => {
История файла и сравнение версий
container.removeEventListener('scroll', listener);
616 animationTargets.forEach(target => { 617 target.removeEventListener('animationstart', handleAnimationStart); 618 target.removeEventListener('animationiteration', handleAnimationStart); 619 target.removeEventListener('animationend', handleAnimationEnd); 620 target.removeEventListener('transitionstart', handleAnimationStart); 621 target.removeEventListener('transitionend', handleAnimationEnd); 624 mutationObserver.disconnect(); 626 artboard.removeEventListener('artBoardResized', handleResize); 631 * Добавляет картинки tooltip-а по истечению 3 сек или при полной загрузке страницы. 633 * @param {HTMLElement} element - текущий элемент 635function t396_tooltip__setupImages() { 636 const setupTooltipImages = () => { 637 const tooltipImages = document.querySelectorAll('.tn-atom__tip-img'); 638 tooltipImages.forEach(image => { 639 const imageOriginal = image.getAttribute('data-tipimg-original'); 640 if (imageOriginal) image.src = imageOriginal; 644 let imagesSetupDone = false; 646 const runSetupOnce = () => { 647 if (!imagesSetupDone) { 648 setupTooltipImages(); 649 imagesSetupDone = true; 653 const timeoutId = setTimeout(runSetupOnce, 3000); 655 window.addEventListener('load', () => { 656 clearTimeout(timeoutId); 662 * Проверяет, отображается ли tooltip 664 * @param {HTMLElement} tooltipContent 668function t396_tooltip__isShown(tooltipContent) { 669 return tooltipContent.classList.contains('tn-atom__tip_visible'); 673 * Возвращает элемент tooltipa .tn-elem по его id и id блока 675 * @param {string} recId 676 * @param {string} elementId 677 * @returns {HTMLElement} 679function t396_tooltip__getTooltipElement(recId, elementId) { 680 return document.querySelector(`#rec${recId} .t396__elem[data-elem-id="${elementId}"]`); 684 * Добавляет oserver на элемент tooltip-а, котрый проверяет при скролле его видимость на экране и если 685 * в течении заданного времени он не виден, то tooltip скрывается. 687 * @param {HTMLElement} element - текущий элемент 688 * @param {number} timeout - время ожидания видимости tooltip-а 689 * @param {HTMLElement} container - контейнер по скрллу которого будет слушаться tooltip 692function t396_tooltip__hideOnScroll(element, timeout = 0, container = null) { 693 if (!element || container === window) return; 697 const options = { threshold: 0 }; 699 options.root = container;