我正在尝试制作一个仅 css 的滑出菜单,它可以滑出和滑回,请参阅我的小提琴http://jsfiddle.net/EZ8SK/1/此处。现在我想将处理程序合并为一个。我尝试使用收音机或复选框这样做,但我无法让它工作,我想我忽略了一些东西。
CSS
#wrapper { width: 100%; height: 100%; }
#header-wrapper { width: 100%; height: 56px; position: relative }
#header { width: 100%; height: 56px; background: #111; position: absolute; }
#content-wrapper { width: 100%; background: #333; }
#left-nav { width: 200px; height: 100%; background: #555; float: left; }
#right-nav { width: 300px; height: 100%; background: #555; float: right; }
#left-nav { margin-top: -392px; transition-duration: .4s }
#left-nav:target { margin-top: -56px }
#nav-menu > .menu-item > .menu-item-link { display: block; padding: 20px; width: calc(200px - (2*20px)); }
#right-menu > .menu-item > .menu-item-link { display: block; padding: 20px; width: calc(300px - (2*20px)); }
.menu-item-link:hover { background: #222 }
#menu-slideout { position: absolute; top: 0; left: 0; color: #fff; }
#last-item { cursor: pointer; display: block; }
#last-item:hover { background: #222; cursor: pointer }
#last-item-back:hover { background: #222; cursor: pointer }
HTML
<div id="header-wrapper">
<div id="header">
<div id="menu-slideout">
<div id="left-nav">
<div class="menu">
<ul id="nav-menu">
<li class="menu-item"><a href="" class="menu-item-link">Menüpunkt</a></li>
<li class="menu-item"><a href="" class="menu-item-link">Menüpunkt</a></li>
<li class="menu-item"><a href="" class="menu-item-link">Menüpunkt</a></li>
<li class="menu-item"><a href="" class="menu-item-link">Menüpunkt</a></li>
<li class="menu-item"><a href="" class="menu-item-link">Menüpunkt</a></li>
<li class="menu-item"><a href="" class="menu-item-link">Menüpunkt</a></li>
<li class="menu-item"><a href="" class="menu-item-link">Menüpunkt</a></li>
<li class="menu-item"><a href="#left-nav" class="menu-item-link" id="last-item">Einblenden</a></li>
<li class="menu-item"><a href="#" class="menu-item-link" id="last-item-back">Ausblenden</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>