Inv commited on
Commit
1031f06
·
verified ·
1 Parent(s): fec7330

the ring doesn't work properly

Browse files
Files changed (2) hide show
  1. script.js +14 -4
  2. style.css +1 -3
script.js CHANGED
@@ -91,21 +91,29 @@ rippleButtons.forEach(button => {
91
  }, 800);
92
  });
93
  });
94
-
95
  // Activity Ring Progress
96
  const ringInput = document.getElementById('ringInput');
97
  const ringProgress = document.getElementById('ringProgress');
98
  const ringPercent = document.getElementById('ringPercent');
99
 
100
- if (ringInput && ringProgress) {
101
  const updateRing = (value) => {
102
  const num = Math.max(0, Math.min(100, parseInt(value) || 0));
103
  ringProgress.style.setProperty('--progress', num);
104
  ringPercent.textContent = `${num}%`;
 
 
 
 
 
 
 
105
  };
106
 
107
  ringInput.addEventListener('input', (e) => {
108
- const value = e.target.value;
 
 
109
  if (value === '' || /^\d+$/.test(value)) {
110
  updateRing(value);
111
  }
@@ -118,8 +126,10 @@ if (ringInput && ringProgress) {
118
  updateRing(ringInput.value);
119
  }
120
  });
121
- }
122
 
 
 
 
123
  // Ring Reset Button
124
  const ringReset = document.getElementById('ringReset');
125
  if (ringReset && ringInput) {
 
91
  }, 800);
92
  });
93
  });
 
94
  // Activity Ring Progress
95
  const ringInput = document.getElementById('ringInput');
96
  const ringProgress = document.getElementById('ringProgress');
97
  const ringPercent = document.getElementById('ringPercent');
98
 
99
+ if (ringInput && ringProgress && ringPercent) {
100
  const updateRing = (value) => {
101
  const num = Math.max(0, Math.min(100, parseInt(value) || 0));
102
  ringProgress.style.setProperty('--progress', num);
103
  ringPercent.textContent = `${num}%`;
104
+
105
+ // Add visual feedback
106
+ if (num > 0) {
107
+ ringProgress.style.boxShadow = '0 0 20px rgba(148, 163, 184, 0.3)';
108
+ } else {
109
+ ringProgress.style.boxShadow = 'none';
110
+ }
111
  };
112
 
113
  ringInput.addEventListener('input', (e) => {
114
+ const value = e.target.value.replace(/[^\d]/g, ''); // Remove non-digits
115
+ ringInput.value = value; // Update input with cleaned value
116
+
117
  if (value === '' || /^\d+$/.test(value)) {
118
  updateRing(value);
119
  }
 
126
  updateRing(ringInput.value);
127
  }
128
  });
 
129
 
130
+ // Initialize ring on load
131
+ updateRing('0');
132
+ }
133
  // Ring Reset Button
134
  const ringReset = document.getElementById('ringReset');
135
  if (ringReset && ringInput) {
style.css CHANGED
@@ -52,11 +52,10 @@ body {
52
  .tilt-card:hover::after {
53
  opacity: 1;
54
  }
55
-
56
  /* Activity ring */
57
  .ring-progress {
58
  --progress: 0;
59
- background: conic-gradient(slate 0 calc(var(--progress) * 1%), #e2e8f0 0);
60
  transition: background .25s ease;
61
  }
62
  .ring-progress::before {
@@ -68,7 +67,6 @@ body {
68
  filter: blur(6px);
69
  z-index: -1;
70
  }
71
-
72
  /* Animated form labels */
73
  .animated-label {
74
  position: absolute;
 
52
  .tilt-card:hover::after {
53
  opacity: 1;
54
  }
 
55
  /* Activity ring */
56
  .ring-progress {
57
  --progress: 0;
58
+ background: conic-gradient(slate 0 calc(var(--progress) * 3.6deg), #e2e8f0 0);
59
  transition: background .25s ease;
60
  }
61
  .ring-progress::before {
 
67
  filter: blur(6px);
68
  z-index: -1;
69
  }
 
70
  /* Animated form labels */
71
  .animated-label {
72
  position: absolute;