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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-tooltip-1.0.js

Код файла
Версия от 18.08.2026, 07:00:16 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1101						dontGoOffScreenY('top', 'bottom');1102					}1103 1104					if (practicalPosition === 'bottom-left') {1105						currentLeft = proxy.offset.left + offsetX;1106						currentTop = proxy.offset.top + proxy.dimension.height + offsetY + 12;1107						dontGoOffScreenX();1108						dontGoOffScreenY('top-left', 'bottom-left');1109					}1110 1111					if (practicalPosition === 'bottom-right') {1112
История файла и сравнение версий
  • 18.08.2026, 07:00:16 · 56c3b845
currentLeft = proxy.offset.left + proxy.dimension.width + offsetX - tooltipWidth;
1113 currentTop = proxy.offset.top + proxy.dimension.height + offsetY + 12;
1114 dontGoOffScreenX();
1115 dontGoOffScreenY('top-right', 'bottom-right');
1116 }
1117
1118 var tooltipStyle = getComputedStyle(self.tooltip, null);
1119
1120 if (practicalPosition === 'left') {
1121 currentLeft = proxy.offset.left - offsetX - tooltipWidth - 12;
1122 currentLeftMirror = proxy.offset.left + offsetX + proxy.dimension.width + 12;
1123 var topDifference =
1124 proxy.offset.top + tooltipHeight - (proxy.offset.top + proxy.dimension.height);
1125 currentTop = proxy.offset.top - topDifference / 2 - offsetY;
1126
1127 // if the tooltip goes off boths sides of the page
1128 if (currentLeft < 0 && currentLeftMirror + tooltipWidth > windowWidth) {
1129 var borderWidth = parseFloat(tooltipStyle.borderWidth) * 2;
1130 var newWidth = tooltipWidth + currentLeft - borderWidth;
1131
1132 self.tooltip.style.width = newWidth + 'px';
1133 tooltipHeight = self.tooltip.offsetHeight;
1134 currentLeft = proxy.offset.left - offsetX - newWidth - 12 - borderWidth;
1135 topDifference =
1136 proxy.offset.top + tooltipHeight - (proxy.offset.top + proxy.dimension.height);
1137 currentTop = proxy.offset.top - topDifference / 2 - offsetY;
1138 } else if (currentLeft < 0) {
1139 // if it only goes off one side, flip it to the other side
1140 currentLeft = proxy.offset.left + offsetX + proxy.dimension.width + 12;
1141 arrowReposition = 'left';
1142 }
1143 }
1144
1145 if (practicalPosition == 'right') {
1146 currentLeft = proxy.offset.left + offsetX + proxy.dimension.width + 12;
1147 currentLeftMirror = proxy.offset.left - offsetX - tooltipWidth - 12;
1148 var topDifference =
1149 proxy.offset.top + tooltipHeight - (proxy.offset.top + proxy.dimension.height);
1150 currentTop = proxy.offset.top - topDifference / 2 - offsetY;
1151
1152 // if the tooltip goes off boths sides of the page
1153 if (currentLeft + tooltipWidth > windowWidth && currentLeftMirror < 0) {
1154 var borderWidth = parseFloat(tooltipStyle.borderWidth) * 2;
1155 var newWidth = windowWidth - currentLeft - borderWidth;
1156
1157 self.tooltip.style.width = newWidth + 'px';
1158 tooltipHeight = self.tooltip.outerHeight(false);
1159 topDifference =
1160 proxy.offset.top + tooltipHeight - (proxy.offset.top + proxy.dimension.height);
1161 currentTop = proxy.offset.top - topDifference / 2 - offsetY;
1162 } else if (currentLeft + tooltipWidth > windowWidth) {
1163 // if it only goes off one side, flip it to the other side
1164 currentLeft = proxy.offset.left - offsetX - tooltipWidth - 12;
1165 arrowReposition = 'right';
1166 }
1167 }
1168
1169 // if arrow is set true, style it and append it
1170 if (self.options.arrow) {
1171 var arrowClass = 'tooltipster-arrow-' + practicalPosition;
1172
1173 // set color of the arrow
1174 if (self.options.arrowColor.length < 1) {
1175 var arrowColor = tooltipStyle.backgroundColor;
1176 } else {
1177 var arrowColor = self.options.arrowColor;
1178 }
1179
1180 // if the tooltip was going off the page and had to re-adjust, we need to update the arrow's position
1181 if (!arrowReposition) {
1182 arrowReposition = '';
1183 } else if (arrowReposition === 'left') {
1184 arrowClass = 'tooltipster-arrow-right';
1185 arrowReposition = '';
1186 } else if (arrowReposition == 'right') {
1187 arrowClass = 'tooltipster-arrow-left';
1188 arrowReposition = '';
1189 } else {
1190 arrowReposition = 'left:' + Math.round(arrowReposition) + 'px;';
1191 }
1192
1193 // building the logic to create the border around the arrow of the tooltip
1194 if (
1195 practicalPosition === 'top' ||
1196 practicalPosition === 'top-left' ||
1197 practicalPosition === 'top-right'
1198 ) {
1199 var tooltipBorderWidth = parseFloat(tooltipStyle.borderBottomWidth);
1200 var tooltipBorderColor = tooltipStyle.borderBottomColor;
Предыдущие 100 строкСледующие 100 строк