jQuery('.title_animate .elementor-heading-title').each(function() { const $this = jQuery(this); const content = $this.text(); var html = ''; for (let i = 0; i < content.length; i++) { html += `<span>${content[i]}</span>`; } $this.html(html); }); window.addEventListener('scroll', function() { var delay = 0; jQuery('.title_animate .elementor-heading-title').each(function() { const scrollY = window.scrollY; const thisTop = jQuery(this).offset().top; const screenHeight = window.innerHeight; const start = thisTop - (screenHeight); const end = thisTop - (screenHeight / 4); const move = scrollY - start; const percent = move / (end - start) * 100; const spans = jQuery(this).find('span'); const animated = Math.floor(spans.length / 100 * percent); spans.each(function(i) { let color = i <= animated ? '#213F39' : 'rgba(33,63,57,0.5)'; if (i <= animated && !jQuery(this).hasClass('animated')) { jQuery(this).css({ transition: `all 0.3s linear`, color: color }); delay += 0.02; jQuery(this).addClass('animated'); } if (i > animated) { jQuery(this).css({ transition: `none`, color: color }); jQuery(this).removeClass('animated'); } }) }) });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter