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.

67 lines
1.5 KiB

  1. semantic.progress = {};
  2. // ready event
  3. semantic.progress.ready = function() {
  4. var
  5. $progress = $('.definition .ui.progress').not('.success, .error, .warning, .indicating'),
  6. $indicating = $('.definition .ui.indicating.progress'),
  7. $buttons = $('.example .increment.button, .example .decrement.button'),
  8. $stateProgress = $('.definition .ui.success.progress, .ui.warning.progress, .ui.error.progress')
  9. ;
  10. setTimeout(function() {
  11. $buttons
  12. .on('click', function() {
  13. var
  14. $progress = $(this).closest('.example').find('.progress')
  15. ;
  16. if( $(this).hasClass('increment') ) {
  17. $progress.progress('increment');
  18. }
  19. else {
  20. $progress.progress('decrement');
  21. }
  22. })
  23. ;
  24. $indicating
  25. .progress({
  26. label : false,
  27. total : 10,
  28. value : Math.floor(Math.random() * 5) + 1,
  29. text : {
  30. active : '{percent}% Funded',
  31. success : 'Project Funded!'
  32. }
  33. })
  34. ;
  35. $progress
  36. .each(function() {
  37. $(this)
  38. .progress({
  39. showActivity : false,
  40. random : {
  41. min : 5,
  42. max : 15
  43. },
  44. percent : Math.floor(Math.random() * 60) + 5
  45. })
  46. ;
  47. })
  48. ;
  49. $stateProgress
  50. .progress('set progress', 100)
  51. ;
  52. }, 300);
  53. };
  54. // attach ready event
  55. $(document)
  56. .ready(semantic.progress.ready)
  57. ;