0
我正在嘗試重新創建帶有靈感來自this live example的翻轉圖像的動畫側面菜單。帶翻滾圖像的動畫側邊菜單
我有下面的代碼,想知道是否有任何可能性鏈接菜單,翻轉演示圖像像我們在上面顯示的例子以及如何。有什麼想法嗎?
body {
font: normal 1.0em Arial, sans-serif;
background: #A8CBFF;
}
nav {
font-size: 3.0em;
line-height: 1.0em;
color: white;
width:6em;
height: 9.0em;
position:absolute;
top:0; bottom:0;
margin:auto;
left: -4.5em;
}
nav ul {
list-style: none;
margin: 0;
padding: 0;
}
nav ul li {
background-color: blue;
height: 1.0em;
padding: 0.25em;
position: relative;
border-top-right-radius: 0.75em;
border-bottom-right-radius: 0.75em;
-webkit-transition: -webkit-transform 500ms, background-color 500ms, color 500ms;
transition: transform 500ms, background-color 500ms, color 500ms;
}
nav ul li:nth-child(1) { background-color: #00aced;}
nav ul li:nth-child(2) { background-color: #3b5998;}
nav ul li:nth-child(3) { background-color: #517fa4;}
nav ul li:nth-child(4) { background-color: #007bb6;}
nav ul li:nth-child(5) { background-color: #cb2027;}
nav ul li:nth-child(6) { background-color: #ea4c89;}
nav ul li:hover {
background-color: #C1232D;
-webkit-transform: translateX(4.5em);
transform: translateX(4.5em);
}
nav ul li span {
display:block;
font-family: Arial;
position: absolute;
font-size:1em;
line-height: 1.25em;
height:1.0em;
top:0; bottom:0;
margin:auto;
right: 0.16666666666667em;
color: #F8F6FF;
}
a {
color: #FFF;
text-decoration: none;
}
<nav>
<ul>
<li><a href="http://www.twitter.com">Category 1</a></li>
<li><a href="http://www.facebook.com">Category 2</a></li>
<li><a href="http://www.instagram.com">Category 3</a></li>
</ul>
</nav>
就是這樣,除了一件事情,在'css'中我們有可能使用'ease-in-out'選項和東西。是否有可能在'js'代碼中設置這些參數?我認爲,在現場示例中,這個翻轉技巧是用純粹的'css'製作的,但不是很確定,我找不到任何相關的js文件。 –
我不推薦在這個例子中使用純CSS。它[可以](http://stackoverflow.com/questions/14139091/set-scrolltop-and-scrollleft-without-javascript)完成,但使用jQuery更適合瀏覽器。至於緩動,如果您使用jQuery UI,則可以在.animate()的末尾包含緩動參數。請參閱上面的編輯答案:) –
簡化選項可以在這裏找到: https://jqueryui.com/resources/demos/effect/easing.html –