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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-cover-1.0.js

Код файла
Версия от 18.08.2026, 07:00:17 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
801	var isLazy = allRec ? allRec.getAttribute('data-tilda-lazy') === 'yes' : false;802	if (!isLazy) return;803	var cover = rec.querySelector('.t-cover__carrier');804	t_onFuncLoad('t_lazyload_updateResize_elem', function () {805		t_lazyload_updateResize_elem(cover);806	});807}808 809/**810 * check is need fixed for background in case if used fixed parallax (only for Safari)811 *812 * @param {string} id - of inited record
История файла и сравнение версий
  • 18.08.2026, 07:00:17 · 56c3b845
813 * @returns {boolean} - in case
814 */
815function t_cover__checkIsFixForBgNeeded(id) {
816 var rec = document.getElementById('rec' + id);
817 var coverCarrier = rec ? rec.querySelector('.t-cover__carrier') : null;
818 if (!coverCarrier) return false;
819
820 var isFixedEarly = rec.getAttribute('data-fixed-bg') === 'y';
821
822 var videoFormats = ['mp4', 'webm', 'youtube', 'vimeo', 'rutube', 'kinescope', 'vkvideo', 'boomstream'];
823 videoFormats = videoFormats.map(function (videoFormat) {
824 return coverCarrier.getAttribute('data-content-video-url-' + videoFormat);
825 });
826
827 var isFixedParallax = coverCarrier.getAttribute('data-content-cover-parallax') === 'fixed';
828
829 var isContainsVideo = videoFormats.some(function (url) {
830 return url;
831 });
832
833 var isMobile = window.t_cover__isMobile || 'ontouchend' in document;
834
835 return isFixedParallax && window.isSafari && !isMobile && !isContainsVideo && !isFixedEarly;
836}
837
838/**
839 * mode for fixed background position
840 *
841 * @param {string} id - of inited record
842 */
843function t_cover__fixBgFixedNode(id) {
844 var isNeedFixForFixedParallax = t_cover__checkIsFixForBgNeeded(id);
845 var rec = document.getElementById('rec' + id);
846 if (!isNeedFixForFixedParallax || !rec) return;
847 var recordType = rec.getAttribute('data-parenttplid') || rec.getAttribute('data-record-type');
848 var cover = rec.querySelector('.t-cover');
849 var coverParent = cover ? cover.parentElement : null;
850
851 if (!document.getElementById('fixed-bg-cover')) {
852 var style = document.createElement('style');
853 style.id = 'fixed-bg-cover';
854 var stylesContent = '';
855 //@formatter:off
856 stylesContent += '.t-cover__container {';
857 stylesContent += 'position: relative;';
858 stylesContent += '}';
859 stylesContent += '.t-cover__container .t-cover {';
860 stylesContent += 'clip: rect(0, auto, auto, 0);';
861 stylesContent += 'position: absolute;';
862 stylesContent += 'top: 0;';
863 stylesContent += 'left: 0;';
864 stylesContent += 'width: 100%;';
865 stylesContent += 'height: 100% !important;';
866 stylesContent += '}';
867 stylesContent += '.t-cover__container .t-cover .t-cover__carrier {';
868 stylesContent += 'position: fixed;';
869 stylesContent += 'display: block;';
870 stylesContent += 'top: 0;';
871 stylesContent += 'left: 0;';
872 stylesContent += 'width: 100%;';
873 stylesContent += 'height: 100% !important;';
874 stylesContent += 'background-size: cover;';
875 stylesContent += 'background-position: center center;';
876 stylesContent += 'transform: translateZ(0);';
877 stylesContent += 'will-change: transform;';
878 stylesContent += '}';
879 //@formatter:on
880 style.textContent = stylesContent;
881 document.head.insertAdjacentElement('beforeend', style);
882 }
883
884 var newWrapper = document.createElement('div');
885 newWrapper.classList.add('t-cover__container');
886 coverParent.insertAdjacentElement('afterbegin', newWrapper);
887
888 newWrapper.style.height = t_cover__getPureHeight(cover) + 'px';
889 newWrapper.appendChild(cover);
890
891 // specific covers fixes - with video popup and avatar section
892 var specificCovers = {
893 275: '.t256__video-container',
894 286: '.t266__video-container',
895 337: '.t-container',
896 906: '.t906__video-container',
897 };
898
899 var classContainer = specificCovers[recordType];
900 var container = classContainer ? rec.querySelector(classContainer) : null;
Предыдущие 100 строкСледующие 100 строк