countbox.js (1329B)
1 (function ($) { 2 3 "use strict"; 4 5 var count_box = function ($scope, $) { 6 7 if($('.count-box').length){ 8 $('.count-box').appear(function(){ 9 10 var $t = $(this), 11 n = $t.find(".count-text").attr("data-stop"), 12 r = parseInt($t.find(".count-text").attr("data-speed"), 10); 13 14 if (!$t.hasClass("counted")) { 15 $t.addClass("counted"); 16 $({ 17 countNum: $t.find(".count-text").text() 18 }).animate({ 19 countNum: n 20 }, { 21 duration: r, 22 easing: "linear", 23 step: function() { 24 $t.find(".count-text").text(Math.floor(this.countNum)); 25 }, 26 complete: function() { 27 $t.find(".count-text").text(this.countNum); 28 } 29 }); 30 } 31 32 },{accY: 0}); 33 } 34 } 35 36 37 $(window).on('elementor/frontend/init', function () { 38 elementorFrontend.hooks.addAction('frontend/element_ready/funfact_section.default', count_box); 39 }); 40 })(window.jQuery);