Telegram
  • Follow Us On :

Become a Certified JavaScript Developer

  • 1
  • 19h 30m
  • 55
  • (4.80)

Are you new to PHP or need a refresher? Then this course will help you get all the fundamentals of…

Hi, Welcome back!
Forgot Password?
jQuery(document).ready(function ($) { $('.like-counter').each(function () { let counter = $(this); let numRolls = counter.find('.number-roll'); let numHeight = counter.find('.number-roll li').height(); numRolls.on('changeData', function () { let number = $(this).data('val'); let offset = number * numHeight * -1; $(this).css("transform", "translateY(" + offset + "px)"); }); counter.on('click', function () { let total = ''; numRolls.each(function () { total += $(this).data('val'); }); let newTotal = parseInt(total) + 1; if (newTotal > 999) newTotal = 0; let digits = newTotal.toString().padStart(3, '0').split(''); numRolls.each(function (i) { $(this).data('val', digits[i]).trigger('changeData'); }); }); numRolls.each(function () { let randVal = Math.floor(Math.random() * 10); $(this).data('val', randVal).trigger('changeData'); }); }); });