Diferencia entre revisiones de «Plantilla:BarraEstadistica»
De Unión PokéPRO - Wiki
Ir a la navegaciónIr a la búsqueda
Sin resumen de edición Etiqueta: Revertido |
Sin resumen de edición Etiquetas: Reversión manual Revertido |
||
Línea 50: | Línea 50: | ||
</div> | </div> | ||
</div> | </div> | ||
<script> | |||
// Función para cambiar el color de las barras según su valor | |||
document.querySelectorAll('.stat-bar').forEach(function(bar) { | |||
var value = parseInt(bar.getAttribute('data-value')); // Obtiene el valor de la estadística | |||
if (value < 50) { | |||
bar.style.backgroundColor = '#ff5959'; // Rojo | |||
} else if (value >= 50 && value < 100) { | |||
bar.style.backgroundColor = '#fae078'; // Naranja | |||
} else { | |||
bar.style.backgroundColor = '#a7db8d'; // Verde | |||
} | |||
}); | |||
</script> |
Revisión del 21:48 28 ene 2025
Estadísticas Base
PS:
Ataque:
Defensa:
At. Esp.:
Def. Esp.:
Velocidad:
<script>
// Función para cambiar el color de las barras según su valor document.querySelectorAll('.stat-bar').forEach(function(bar) { var value = parseInt(bar.getAttribute('data-value')); // Obtiene el valor de la estadística if (value < 50) { bar.style.backgroundColor = '#ff5959'; // Rojo } else if (value >= 50 && value < 100) { bar.style.backgroundColor = '#fae078'; // Naranja } else { bar.style.backgroundColor = '#a7db8d'; // Verde } });
</script>