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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-animation-ext-1.0.js

Код файла
Версия от 04.12.2026, 04:03:53 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1201function t_animationExt__getParallaxSpeed(value, min, max) {1202	return value <= min ? min : value >= max ? max : value;1203}1204 1205function t_animationExt__getParallaxPosition(speed, percentage) {1206	return Math.round(speed * (100 * (1 - percentage)));1207}1208 1209/*============= Support functions ==============*/1210 1211/**1212 * get height without padding
История файла и сравнение версий
  • 04.12.2026, 04:03:53 · 56c3b845
1213 *
1214 * @param {HTMLElement} el - current element
1215 * @returns {number} - height without padding
1216 */
1217function t_animationExt__getPureHeight(el) {
1218 if (!el) return 0;
1219 var elHeight = el.clientHeight || el.offsetHeight || parseInt(window.getComputedStyle(el).height, 10);
1220 var elPaddingTop = el.style.paddingTop || 0;
1221 var elPaddingBottom = el.style.paddingBottom || 0;
1222 return elHeight - (elPaddingTop + elPaddingBottom);
1223}
1224
1225function t_animationExt__isElementHidden(el) {
1226 return !el.offsetWidth && !el.offsetHeight && !el.getClientRects().length;
1227}
1228
1229/**
1230 * check old IE versions
1231 *
1232 * @returns {boolean} - is old IE version
1233 */
1234function t_animateParallax__checkOldIE() {
1235 var iEIndex = window.navigator.userAgent.indexOf('MSIE');
1236 if (iEIndex === -1) return false;
1237 var ieVersion = parseInt(
1238 window.navigator.userAgent.substring(iEIndex + 5, window.navigator.userAgent.indexOf('.', iEIndex)),
1239 10
1240 );
1241 return ieVersion === 8 || ieVersion === 9 || ieVersion === 10;
1242}
1243
1244/**
1245 * window.tn_scale_factor used for old sites
1246 *
1247 * @param {HTMLElement} el - current element
1248 * @returns {number} - zoom value
1249 */
1250function t_animationExt__getZoom(el) {
1251 if (typeof el.scaleFactor !== 'undefined') return el.scaleFactor;
1252 var artboard = el.closest('.t396__artboard');
1253 if (!artboard) return 1;
1254 var abID = artboard.getAttribute('data-artboard-recid');
1255 if (
1256 artboard.classList.contains('t396__artboard_scale') ||
1257 t_animationExt__getAttrByRes(artboard, 'data-artboard-upscale', '', 0) === 'window'
1258 ) {
1259 return abID && window.tn['ab' + abID]
1260 ? window.tn['ab' + abID].scaleFactor || window.tn_scale_factor
1261 : window.tn_scale_factor;
1262 }
1263 return 1;
1264}
1265
1266/**
1267 * get value from attribute, it depends on resolution parameter, element contains mobile animation, or not
1268 *
1269 * @param {HTMLElement} el - current element
1270 * @param {string} attr - animation attribute
1271 * @param {string} preffix - animation attribute preffix (data-animate-)
1272 * @param {number} resolution - resolution, in many times use window.innerWidth
1273 * @returns {string} - attribute value (empty string - if attribute is not defined, or el is not defined
1274 */
1275function t_animationExt__getAttrByRes(el, attr, preffix, resolution) {
1276 if (!el?.isConnected) return '';
1277 var isElHasMobileAnimation = el.getAttribute('data-animate-mobile') === 'y';
1278 var foundValue;
1279 var breakpoints = [];
1280 var resolutionMax;
1281
1282 var artBoard = el.closest('.t396__artboard');
1283 var recid = artBoard.getAttribute('data-artboard-recid');
1284 var artBoardId = 'ab' + recid;
1285
1286 if (typeof window.tn[artBoardId] !== 'undefined') {
1287 if (!resolution) resolution = window.tn[artBoardId].curResolution;
1288 resolutionMax = window.tn[artBoardId].curResolution_max;
1289 breakpoints = window.tn[artBoardId].screens.slice(0, window.tn[artBoardId].screens.length - 1);
1290 } else {
1291 if (!resolution) resolution = window.tn.curResolution;
1292 resolutionMax = 1200;
1293 breakpoints = [320, 480, 640, 960];
1294 }
1295
1296 if (resolution === resolutionMax) {
1297 return el.getAttribute(preffix + attr);
1298 } else if (preffix && !isElHasMobileAnimation && resolution < 1200) {
1299 el.style.transition = 'none';
1300 return '';
Предыдущие 100 строкСледующие 100 строк