bonjour, je me trouve avec un problème très basique mais très agaçant... Je souhaite, lorsque je clique sur ma div, qu'elle grandisse, que la couleur change, etc. mais je souhaite également la refermer lorsque je clique sur la "flèche retour" or ça ne marche pas.
Voici le code en question:
Code css : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 #crosscol{ margin:0; } .menuhoz{ background-color:#171717; color:#ff9900; height:50px; width:50px; line-height:50px; text-align:center; transition:all 0.5s; } .menuhoz:hover{ color:#171717; background-color:#ff9900; cursor:pointer; } .menuhoz #imgmenuhoz{ width:0px; height:0px; margin-top:2px; margin-left:2px; cursor:pointer; float:left; }
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 <div id="menuhoz" class="menuhoz"> <img id="imgmenuhoz" src="http://www.zupmage.eu/i/BdD50UvFdR.png"></img><span>MENU</span> </div>
Code JS : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 var MENUHOZ = document.getElementById("menuhoz") var IMG = document.getElementById("imgmenuhoz") MENUHOZ.style.cssText = 'transition:all 1s;'; IMG.style.cssText = 'transition:all 1s 1s;'; MENUHOZ.onclick = function(){ MENUHOZ.style.cssText = 'background-color:#ff9900;color:#171717;cursor:default'; MENUHOZ.style.width = '100%'; MENUHOZ.style.height = '100px'; IMG.style.width = '15px'; IMG.style.height = '15px'; } IMG.onclick = function(){ MENUHOZ.style.cssText = 'background-color:#171717;;color:#ff9900'; MENUHOZ.style.width = '50px'; MENUHOZ.style.height = '50px'; IMG.style.width = '0px'; IMG.style.height = '0px'; };
Et la démo correspondante... Merci de noter les modifications sur votre post.
Merci pour votre aide, pito2901
Partager