0
如何在離開時製作菜單隻能在點擊十字後隱藏?因爲現在當你打開菜單時你可以點擊任何地方,他會隱藏起來。CSS,右側傳出菜單
https://jsfiddle.net/fm7ayygc/
<nav class="site-nav">
<button class="side-menu-trigger"><span class="glyphicon" style=" font-size: 10px; margin-right: 3px;">
</span>Pokaż menu</button>
<aside class="side-menu">
<div class="row center-block">
<div class="col-md-3">
<h4>Menu</h4>
</div>
</div>
</aside>
</nav>
CSS
.site-nav {
display: flex;
justify-content: flex-end;
align-items: center;
padding: 10px;
box-sizing: border-box;
height: 20px;
width: 100%;
}
.side-menu-trigger {
margin-top: 90px;
position: absolute;
right: 0;
background-color: #0079BF;
border: 0;
text-decoration: underline;
}
.side-menu {
position: absolute;
height: 100%;
width: 300px;
top: 40px;
right: -300px;
padding: 0;
background: #EDEFF0;
transition: 0.3s transform ease-in-out;
}
.side-menu-trigger:focus ~ .side-menu, .side-menu:hover {
transform: translateX(-300px);
}
您能否澄清一下您的問題到底是什麼? –
當你打開菜單,然後點擊你想要在菜單之外的任何地方時,他會隱藏起來,我不喜歡它,我只需要當我想要時消失,當我點擊十字架 –