3
我正在製作一個圓形的漢堡包菜單按鈕,該菜單按鈕在懸停時生成動畫,從中心向上生長,以三個小節divs爲中心,位於父div圓圈內。父div上的CSS轉換導致絕對子div跳轉?
父div具有固定位置以啓用「增長」效果。這三個漢堡包菜單行是絕對定位的div。
徘徊時,一切都通過過渡動畫,例外的三個孩子的div跳從右下角懸停得很順利,並頂部上鼠標左鍵出來。我試過調整邊距,寬度/高度和定位,但我被卡住了。我錯過了什麼?
.circle-nav {
display: block;
position: fixed;
width: 44px;
height: 44px;
top: 35px;
left: 35px;
color: rgba(255, 255, 255, 0.8);
background-color: rgb(136, 35, 24);
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 2px 2px rgba(0, 0, 0, 0.05);
-webkit-border-radius: 22px;
-moz-border-radius: 22px;
border-radius: 22px;
transition: width 300ms ease, height 300ms ease, transform 300ms ease, background 300ms ease, border-radius 300ms ease, box-shadow 300ms ease, top 300ms ease, left 300ms ease;
}
.circle-nav:hover {
width: 66px;
height: 66px;
top: 25px;
left: 25px;
background-color: rgb(187, 53, 39);
box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3), 0 8px 6px rgba(0, 0, 0, 0.05);
-webkit-border-radius: 33px;
-moz-border-radius: 33px;
border-radius: 33px;
}
.top-bar,
.mid-bar,
.bot-bar {
width: 22px;
height: 2px;
position: absolute;
left: 11px;
background-color: #fff;
}
.top-bar {
top: 14px;
}
.mid-bar {
top: 21px;
}
.bot-bar {
top: 28px;
}
.circle-nav:hover .top-bar {
top: 24px;
}
.circle-nav:hover .mid-bar {
top: 31px;
}
.circle-nav:hover .bot-bar {
top: 38px;
}
.circle-nav:hover .top-bar,
.circle-nav:hover .mid-bar,
.circle-nav:hover .bot-bar {
left: 22px;
}
<div class="circle-nav">
<div class="top-bar"></div>
<div class="mid-bar"></div>
<div class="bot-bar"></div>
</div>
謝謝哈利這一點。我選擇退出此選項,而現在正在使用縮放。但我很感激修復。由於我的菜單是一個複選框,我不確定這是否會因爲其他變量而失效。我會稍後再研究。 –
@Ce .:解決方案也應該與複選框一起工作,但在我看來,縮放轉換絕對是更好的選擇。我以爲你出於某種原因不想使用它。 – Harry