} }); startTypWhenComplPrev(textElemsClear, 0, textElemsClear.length); } function startTypWhenComplPrev(textElemsClear, currIndex, length) { var currentElem = textElemsClear[currIndex]; var text = $('.' + currentElem.ElemForSoft + ' .tn-atom').text(); $('.' + currentElem.ElemForSoft + ' .tn-atom').text(''); $(currentElem).show(); //show image $(document).find('.' + currentElem.ElemForDef).each(function(){ if ($(this).find('.tn-atom__img').length > 0) { $(this).show(); } if ($(this).find('h3').length > 0) { $(this).show(); } }); currentElem.style.borderRadius = '24px'; currentElem.style.background = 'rgba(255, 255, 255, 0.15)'; currentElem.style.padding = '24px 40px'; if (window.innerWidth < 460) { currentElem.style.padding = '12px 20px'; } var typed = new Typed('.' + currentElem.ElemForSoft + ' .tn-atom', { strings: [text], typeSpeed: 30, // typing speed loop: false, // loop on or off (true or false) showCursor: true, cursorChar: '|', onBegin: (self) => { self.el.style.color = '#D31E25'; self.el.style.display = 'inline'; }, onComplete: (self) => { self.el.style.color = '#fff'; if (currIndex < length) { //запустить следующий элемент startTypWhenComplPrev(textElemsClear, currIndex + 1, length) }; }, }); } function sortByClassNumber(a, b){ return (Number(a.indexElemForSoft) < Number(b.indexElemForSoft)) ? -1 : 1; } function uuidv4() { return "uc_js_chat_10000000_1000_4000_8000_100000000000".replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) ); } jQuery.expr.pseudos.regex = jQuery.expr.createPseudo(function (expression) { return function (elem) { var matchParams = expression.split(','), validLabels = /^(data|css):/, attr = { method: matchParams[0].match(validLabels) ? matchParams[0].split(':')[0] : 'attr', property: matchParams.shift().replace(validLabels, '') }, regexFlags = 'ig', regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g, ''), regexFlags); return regex.test(jQuery(elem)[attr.method](attr.property)); } });
Made on
Tilda