Je crée un menu CSS uniquement avec transition. L'approche que je prends est quand le bouton de menu est coché (cliqué) le menu transite du côté droit. C'est le point sur lequel je suis coincé ... le menu disparaît juste après la fin de la transition; il disparaît.Élément transité avec: coché ne pas apparaître après la fin de la transition
Est-ce que quelqu'un voit pourquoi cela se produit et comment je peux le réparer?
#mobile-button {
\t background-image: url("https://optimumwebdesigns.com/icons/menu.png");
background-size: 30px 30px;
\t float: right;
\t width: 30px;
\t height: 30px;
\t margin-right: 5%;
\t margin-top: 15px;
\t cursor: pointer;
\t display: block;
\t transition: ease 0.3s;-webkit-transition: ease 0.3s;
}
#nav-pop {
\t background: rgba(0,0,0,0.7);
\t height: 100vh;
}
#mobile-check:not(:checked) ~ #nav-pop {
\t opacity: 0;
\t right: 0;
\t margin-top: 0;
\t margin-right: 0;
\t z-index: 999999;
\t transition: ease 0.6s;-webkit-transition: ease 0.6s;
\t transform: translateX(0);-webkit-transform: translateX(0);
}
#mobile-check:checked ~ #nav-pop {
\t float: none;
\t opacity: 1;
\t position: fixed;
\t margin-top: 0;
\t width: 70%;
\t right: -100%;
\t height: 100vh;
\t transform: translateX(100%);-webkit-transform: translateX(100%);
}
<input type="checkbox" id="mobile-check">
<label id="mobile-button" for="mobile-check"></label>
<div id="nav-pop">
<div id="nav-pop-close"></div>
<ul id="nav-list">
<li><a href="about">ABOUT</a></li>
<li><a href="services">SERVICES</a></li>
<li><a href="project">PROJECT</a></li>
<li><a href="contact">CONTACT</a></li>
</ul>
</div>
Est-ce la façon dont il est censé regarder? https://jsfiddle.net/cqofj101/2/ – cjl750
@ cjl750 Cette fonctionnalité est parfaite. Merci! Donc, essentiellement, mon «droit» initial était contradictoire? – Paul
La valeur 'right' était la plus grande partie, oui. Je posterai une réponse. – cjl750