0
Well, I have an image for demonstration
When a user clicks on one, the bottom of the body will change according to what he chose. But in this case the background is an image that corresponds to those colors. How can I do this?
0
Well, I have an image for demonstration
When a user clicks on one, the bottom of the body will change according to what he chose. But in this case the background is an image that corresponds to those colors. How can I do this?
0
Good with javascript is more difficult... I will use jquery if you want to use !
<div id="azul">azul</div>
<br>
<div id="vermelho">vermelho</div>
<br>
<div id="cinza">cinza</div>
<br>
Well just you read and code n is hard... anything talks
$("#azul").click(function() {
$("body").css({
"background": "blue";
});
$("#cinza").click(function() {
$("body").css({
"background": "#ccc";
});
$("#vermelho").click(function() {
$("body").css({
"background": "red";
});
});
EDIT: Leandro, don’t forget to put ";" to close. This is important.
0
Basis of how you want adapting the code of Leandro:
$("#azul").click(function() {
$("body").css({
"background": "url(azul.png)";
});
$("#cinza").click(function() {
$("body").css({
"background": "url(cinza.png)";
});
$("#vermelho").click(function() {
$("body").css({
"background": "url(vermelho.png)";
});
});
vlw bro, wanted it right, thanks leandro tbm
Browser other questions tagged php javascript html css
You are not signed in. Login or sign up in order to post.
Got it. I thought this was js kkk I confusing the two
– Gleidorf
But how do I put on picture?
– Gleidorf
simple - instead of #ccc or the color vc puts the path of the image type "background": "url(img.png)" excuse the delay because I am programming.
– Leandro Ferreira