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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-animation-sbs-1.0.js

Код файла
Версия от 05.12.2026, 07:01:09 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
4201	});4202 4203	animatedObject.clickedTriggerEls.forEach(function (el) {4204		el.removeEventListener('click', t_animationSBS__initClickCallback);4205		t_animationSBS__removeTriggerList(el, 'click');4206	});4207 4208	animatedObject.hoverTriggerEls.forEach(function (el) {4209		el.removeEventListener('click', t_animationSBS__initHoverTrigger);4210		el.removeEventListener('mouseenter', t_animationSBS__initHoverTrigger);4211		el.removeEventListener('mouseleave', t_animationSBS__initHoverTrigger);
История файла и сравнение версий
  • 05.12.2026, 07:01:09 · 56c3b845
4212
t_animationSBS__removeTriggerList(el, 'hover');
4213 });
4214
4215 t_animationSBS__updateAnimatedObjectState(animatedObject, 'clickedTriggerEls', []);
4216 t_animationSBS__updateAnimatedObjectState(animatedObject, 'hoverTriggerEls', []);
4217}
4218
4219function t_animationSBS__removeTriggerList(element, type) {
4220 if (element['triggerList-on-' + type]) element['triggerList-on-' + type] = [];
4221 if (element['triggerOnceList-on-' + type]) element['triggerOnceList-on-' + type] = [];
4222}
4223
4224//============================ on action animation: hover and click ============================//
4225
4226/**
4227 * init animation with click
4228 *
4229 * @param {animatedObject} animatedObject - options
4230 */
4231function t_animationSBS__initClickTriggers(animatedObject) {
4232 var clickedElements = animatedObject.elements.filter(function (el) {
4233 return el.getAttribute('data-animate-sbs-event') === 'click';
4234 });
4235 if (!clickedElements.length) return;
4236 t_animationSBS__connectTriggersWithAnimEls(clickedElements);
4237 var triggerClickElements = Array.prototype.slice.call(document.querySelectorAll('.js-sbs-anim-trigger_click'));
4238 if (!triggerClickElements.length) return;
4239
4240 // if element has class .js-sbs-anim-trigger_click, set style cursor: pointer;
4241 if (!document.getElementById('js-sbs-anim-trigger-styles')) {
4242 var clickStyles = document.createElement('style');
4243 clickStyles.id = 'js-sbs-anim-trigger-styles';
4244 clickStyles.textContent = '.js-sbs-anim-trigger_click { cursor: pointer; }';
4245 document.head.insertAdjacentElement('beforeend', clickStyles);
4246 }
4247
4248 animatedObject.clickedTriggerEls = triggerClickElements;
4249 // remove old listener, and set new one
4250 triggerClickElements.forEach(function (triggerClickElement) {
4251 t_animationSBS__preventAnimatedParentTrigger(triggerClickElement);
4252 triggerClickElement.removeEventListener('click', t_animationSBS__initClickCallback);
4253 triggerClickElement.addEventListener('click', t_animationSBS__initClickCallback);
4254 });
4255}
4256
4257/**
4258 * trigger and start animation by click
4259 */
4260function t_animationSBS__initClickCallback() {
4261 var triggerList = this['triggerList-on-click'] || [];
4262 var triggerOnceList = this['triggerOnceList-on-click'] || [];
4263
4264 if (!triggerList.length && !triggerOnceList.length) return;
4265 t_animationSBS__playOnceAnimation(this, triggerOnceList, 'click');
4266
4267 triggerList.forEach(function (element) {
4268 if (element.classList.contains('t-sbs-anim_started') && !element.classList.contains('t-sbs-anim_reversed')) {
4269 t_animationSBS__setActionOnEnd(element);
4270 } else {
4271 t_animationSBS__setActionOnStart(element);
4272 }
4273 });
4274}
4275
4276function t_animationSBS__playOnceAnimation(currentEl, triggerOnceList, type) {
4277 if (!triggerOnceList || !triggerOnceList.length) return;
4278 t_animationSBS__actionOnStart(triggerOnceList);
4279 var event = document.createEvent('Event');
4280 event.initEvent('updateAnimOnce', true, true);
4281 triggerOnceList.forEach(function (el) {
4282 el.dispatchEvent(event);
4283 });
4284 currentEl['triggerOnceList-on-' + type] = [];
4285}
4286
4287/**
4288 *
4289 * @param {animatedObject} animatedObject - options
4290 */
4291function t_animationSBS__initHoverTriggers(animatedObject) {
4292 var hoveredElements = animatedObject.elements.filter(function (el) {
4293 return el.getAttribute('data-animate-sbs-event') === 'hover';
4294 });
4295 if (!hoveredElements.length) return;
4296 t_animationSBS__connectTriggersWithAnimEls(hoveredElements);
4297
4298 // catch hover events on triggers
4299 var triggerHoverElements = document.querySelectorAll('.js-sbs-anim-trigger_hover');
4300 triggerHoverElements = Array.prototype.slice.call(triggerHoverElements);
Предыдущие 100 строкСледующие 100 строк