Change layout color [closed]

-1

I wanted to create a function to change the colors of the site layout they are developing, this site is made in CodeIgniter, CSS3 and a bit of pure Javascript, I gave a search on the internet and did not find much, but by little knowledge that I believe to be in JS this type of modification. The function would stay in the Dashboard and the user could change colors as soon as they wanted, colors already pre-defined.

    
asked by anonymous 04.12.2018 / 00:05

1 answer

0

Exactly, you can use JS, using the .style attribute to change the CSS of a div . See this example

#quadrado {
    background: #000;
    width: 100px;
    height: 100px;
}
<div id='quadrado'></div>

<button type="button" onclick="document.getElementById('quadrado').style.background = 'blue'">Deixar azul!</button>
<button type="button" onclick="document.getElementById('quadrado').style.background = 'red'">Deixar vermelho!</button>
<button type="button" onclick="document.getElementById('quadrado').style.background = 'green'">Deixar verde!</button>

In it, when we click on any of the buttons, we select through the ID the square and change the property background , inserting the color that we want. This is only a basis for you to customize according to your needs.

    
04.12.2018 / 01:57