Number counter animation preloader window when loading Javascript Html CSS
P粉523625080
P粉523625080 2023-09-11 22:37:54
0
1
629

I want to create a number counter animation on my portfolio website. I have some jquery code in my old website that transitions from the preloader to the website when fully loaded.

<script>
  $(window).on('load', () => {
    $('#preloader').fadeOut(1800, function() {
      $(this).remove();
    });
  });
    </script>

How to add number counter animation and add side to upward transition? Thanks

P粉523625080
P粉523625080

reply all(1)
P粉497463473

for you.

  1. Announce count.
  2. Decrease the count value.
  3. Delete the counter span based on the counter value slideUp of your div and .

Example:

$(window).on('load', () => {
  let count = 3;
  function ShowCounter() {
    if (count > 0) {
      $("#spnNumber").fadeOut('slow', function() {
        $("#spnNumber").text(count);
        $("#spnNumber").fadeIn();
        count--;
      });

    } else if (count == 0) {
      $("#preloader").slideUp();
      $("#spnNumber").remove();
      clearInterval(interval);

    }

  }
  var interval = setInterval(function() {
    ShowCounter()
  }, 1000)
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id='preloader'>Loading ... </div>
<span id='spnNumber'><span>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template