火箭军大屏html静态页面
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1 KiB

  1. jQuery(function ($) {
  2. // custom formatting example
  3. $('#earth').data('countToOptions', {
  4. formatter: function (value, options) {
  5. return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ',');
  6. }
  7. });
  8. // custom callback when counting completes
  9. $('#countdown').data('countToOptions', {
  10. onComplete: function (value) {
  11. $(this).text('BLAST OFF!').addClass('red');
  12. }
  13. });
  14. // another custom callback for counting to infinity
  15. $('#infinity').data('countToOptions', {
  16. onComplete: function (value) {
  17. count.call(this, {
  18. from: value,
  19. to: value + 1000
  20. });
  21. }
  22. });
  23. // start all the timers
  24. $('.timer').each(count);
  25. // restart a timer when a button is clicked
  26. $('.restart').click(function (event) {
  27. event.preventDefault();
  28. var target = $(this).data('target');
  29. $(target).countTo('restart');
  30. });
  31. function count(options) {
  32. var $this = $(this);
  33. options = $.extend({}, options || {}, $this.data('countToOptions') || {});
  34. $this.countTo(options);
  35. }
  36. });