Vanilla javaScript: Text Reveal Effect On Scroll

Поделиться
HTML-код
  • Опубликовано: 28 ноя 2024

Комментарии • 28

  • @deepak8586
    @deepak8586 Год назад +2

    I have been looking for this all over youtube thanks for sharing!!

  • @aleksejsskurjats6394
    @aleksejsskurjats6394 Год назад +2

    Thanks man for sharing your knowledge! 🚀💥

  • @kelligart4847
    @kelligart4847 Год назад

    Another great tutorial, thanks Conor !

  • @danielmosca1653
    @danielmosca1653 8 дней назад

    great! thank you!!
    how could I do if I'd add a blur effect?

  • @MatteoMastrototaro-q6o
    @MatteoMastrototaro-q6o Год назад +2

    Thank you so much for this tutorial, such a great animation. But I'm having trouble because it slows my website a lot, it seems like lagging when reach the point with the animated paragraph. Do you have any suggestions to make it lighter?
    EDIT: I solved the problem by splitting paragraphs by words and not by a single character. Much lighter!
    To do that just change
    → let pArray = paragraph.textContent.split('');
    to this
    → let pArray = paragraph.textContent.split(' ');
    And I added padding-right to span style, to simulate blank spaces between words.
    Hope this will be useful to someone stuck in the same situation I was.

  • @howuseehim
    @howuseehim Год назад +1

    What is your theme ? Thanks for the tuts very useful stuff as usual

    • @ConorBailey
      @ConorBailey  Год назад

      Thanks! its GitHub Dark theme in VS Code..

  • @WorshipMinistryTraining
    @WorshipMinistryTraining 4 месяца назад

    Can I make it one word at a time, instead of one character at a time?

  • @guru-xn9yp
    @guru-xn9yp Год назад +1

    thanks a lot man! what's that vscode theme btw?

    • @ConorBailey
      @ConorBailey  Год назад

      Thanks. Its GitHub Dark theme

    • @guru-xn9yp
      @guru-xn9yp Год назад +1

      @@ConorBailey much appriciated, keep your awsome tuts coming 🙏

  • @tomsgxdv2528
    @tomsgxdv2528 Год назад

    thank you for this great work!
    Can you help me, I'm having trouble changing the opacity of the text lower in the screen (top position about 50%) because it causes reading problems. (I don't know what values to change)
    THANK YOU

  • @truowng
    @truowng Год назад

    Thanks for sharing ❤

  • @ggwp185
    @ggwp185 10 месяцев назад

    So u can now do this only using CSS.
    Use animation timeline view

    • @ConorBailey
      @ConorBailey  10 месяцев назад

      Nice! Will look into this!

    • @kravitz78
      @kravitz78 День назад

      @@ConorBailey not gonna work in safari

  • @TonyMathew-j5p
    @TonyMathew-j5p 4 месяца назад

    where does span added in html

  • @Babbili
    @Babbili Год назад

    so nice

  • @Uncaught_in_promise
    @Uncaught_in_promise Год назад

    what about mobile devices? does it work on mobile?

    • @ConorBailey
      @ConorBailey  Год назад +1

      Hi. Yes I’ve tested this on mobile and it works great!

  • @hail816
    @hail816 Год назад

    Can you create a tutorial on webgl image hover effects without using plugins?

  • @bewise2023
    @bewise2023 Год назад

    is there any code link
    my this code is not working

    • @bewise2023
      @bewise2023 Год назад

      let paragraphs = [...document.querySelectorAll('p')]
      let spans = [];
      paragraphs.forEach(paragraph => {
      let htmlString = '';
      let pArray = paragraph.textContent.split('')
      for(let i = 0;i 1 ? 1 : opacityValue.toFixed(3);
      spans[i].style.opacity = opacityValue;
      }
      }
      }
      window.addEventListener('scroll', () => {
      revealSpans();
      })
      revealSpans();

    • @ConorBailey
      @ConorBailey  Год назад

      I can post it later. What error are you receiving? I can try to help.

    • @evanmatthews4097
      @evanmatthews4097 Год назад +1

      @@ConorBailey Drop us the code, bro!

    • @dcampagne1
      @dcampagne1 Год назад

      @@ConorBailey post it! don't be shy

    • @dcampagne1
      @dcampagne1 Год назад +5

      @@evanmatthews4097 let paragraphs = [...document.querySelectorAll('p')];
      let spans = [];
      paragraphs.forEach(paragraph => {
      let htmlString = '';
      let pArray = paragraph.textContent.split('');
      for (let i = 0; i < pArray.length; i++) {
      htmlString += `${pArray[i]}`;
      }
      paragraph.innerHTML = htmlString;
      });
      spans = [...document.querySelectorAll('span')];
      function revealSpans() {
      for (let i = 0; i < spans.length; i++) {
      if (spans[i].parentElement.getBoundingClientRect().top < window.innerHeight / 2) {
      let { left, top } = spans[i].getBoundingClientRect();
      top = top - (window.innerHeight * 0.2);
      let opacityValue = 1 - ((top * 0.01) + (left * 0.001));
      opacityValue = opacityValue < 0.1 ? 0.1 : opacityValue > 1 ? 1 : opacityValue.toFixed(3);
      spans[i].style.opacity = opacityValue;
      }
      }
      }
      window.addEventListener('scroll', revealSpans);
      revealSpans();