Hello à tous,
Je sèche un peu sur un point là. Je m'aventure dans les pseudo-classes CSS3 et suis parvenu à provoquer un changement d'état sur un autre élément CSS. Ex :
Une petite icône hamburger typique versions mobiles
Code :
- #menutoggle {
- position:fixed;
- right:0%;
- top:0px;
- width:12%;
- z-index:50;
- padding-top:2%;
- padding-bottom:2%;
- background-color:#333333;
- -webkit-transition: all 250ms linear;
- -moz-transition: all 250ms linear;
- -o-transition: all 250ms linear;
- transition: all 250ms linear;
- }
|
Un menu caché :
Code :
- #menu {
- position:fixed;
- height:100%;
- width:88%;
- top:0px;
- right:-88%;
- z-index:50;
- background-color:#333333;
- -webkit-transition: all 250ms linear;
- -moz-transition: all 250ms linear;
- -o-transition: all 250ms linear;
- transition: all 250ms linear;
- }
|
En focus, mon hamburger se déplace
Code :
- #menutoggle:focus {
- right:88%;
- outline:0;
- -webkit-transition: all 250ms linear;
- -moz-transition: all 250ms linear;
- -o-transition: all 250ms linear;
- transition: all 250ms linear;
- }
|
Mais surtout, il fait apparaître mon menu, ça marche nickel.
Code :
- #menutoggle:focus ~ #menu {
- right:0%;
- -webkit-transition: all 250ms linear;
- -moz-transition: all 250ms linear;
- -o-transition: all 250ms linear;
- transition: all 250ms linear;
- }
|
PAR CONTRE,
Je voulais faire pareil avec mon champs de recherche. Donc hop une petite loupe à côté de mon hamburger
Code :
- #loupetoggle {
- position:fixed;
- right:13%;
- top:0px;
- width:12%;
- z-index:50;
- padding-top:2%;
- padding-bottom:2%;
- background-color:#333333;
- -webkit-transition: all 250ms linear;
- -moz-transition: all 250ms linear;
- -o-transition: all 250ms linear;
- transition: all 250ms linear;
- }
|
Un champs de recherche caché
Code :
- #mainsearchfield {
- position:fixed;
- height:15%;
- width:100%;
- top:-15%;
- left:0%;
- z-index:50;
- background-color:#333333;
- -webkit-transition: all 250ms linear;
- -moz-transition: all 250ms linear;
- -o-transition: all 250ms linear;
- transition: all 250ms linear;
- }
|
Quand on clique sur la loupe, le champs de recherche apparaît, tout va bien
Code :
- #loupetoggle:focus ~ #mainsearchfield {
- top:0%;
- -webkit-transition: all 250ms linear;
- -moz-transition: all 250ms linear;
- -o-transition: all 250ms linear;
- transition: all 250ms linear;
- }
|
Mais en voulant utiliser le formulaire, le champs remonte, puisque je n'ai plus le focus sur la loupe. Mais même en donnant le focus sur mon champs de formulaire et en y mettant ma pseudo classe, rien n'y fait, le champs remonte à sa position initiale.
Code :
- .forminputtxtall:focus ~ #mainsearchfield {
- top:0%;
- -webkit-transition: all 250ms linear;
- -moz-transition: all 250ms linear;
- -o-transition: all 250ms linear;
- transition: all 250ms linear;
- }
|
Comment régler ce problème ??
Merci beaucoup !
---------------
SHOOT ME AGAIN WEBZINE