Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.31 KB

README.md

File metadata and controls

58 lines (39 loc) · 1.31 KB

RETO - TARJETA DE PRODUCTO

He añadido botones para cambiar a diferentes colores de tenis, además el en titulo aparece el color y cada botón el color de la sección.

Amarillo:

Amarillo

Azul:

Azul

Negro:

Negro

Rojo:

Rojo

Blanco:

Blanco

Código importante:

/* FUNCIONAMIENTO DE LOS BOTONES */
Boton.addEventListener('click', () =>{

    const URL_Tenis = 'imagen.png';

    Personalizacion( "color de fondo", "color imgBox", URL_Tenis, 'Color', 'Color Boton', "Color letra del boton");  
})

/* FUNCIÓN QUE MODIFICA EL ESTILO Y ATRIBUTOS DEL HTML */
function Personalizacion(colorFondo, ColorImgBox, tenis, color, colorBtn, TextoBtn)
{
    /* FONDO */
    Body.style.backgroundColor = colorFondo;
    imgBox.style.backgroundColor = ColorImgBox;

    /* TENIS */
    IMG.setAttribute('src', tenis);
    IMG.style.width = '500px';
    IMG.style.height = '554px';

    /* TITULO DE LA TARJET */
    Titulo.innerHTML = `Nike ${color} 2020`;
    /* BOTON DE COMPRA */
    BotonCompra.style.backgroundColor = colorBtn;
    BotonCompra.style.color = TextoBtn;
}