0
我試圖獲得它,這樣當你將鼠標懸停在框上時,'^'將向上移動。目前它在over狀態上處於正確的位置,但它不適用於css轉換。爲什麼'頂部'屬性不能生成transistion?
的jsfiddle:http://jsfiddle.net/9f9fyaj2/
HTML:
<a href="#">
<div class="scrollToTop">
<i>^</i>
</div>
</a>
CSS:
body{
background: #7A7A7A;
}
.scrollToTop{
color: rgba(255,255,255,1);
background: rgba(0,0,0,0.5);
width: 50px;
height: 50px;
position: fixed;
right: 20px;
bottom: 20px;
}
.scrollToTop i{
position: absolute;
top: 0px;
-webkit-transition: top .02s ease-out;
-moz-transition: top .02s ease-out;
-ms-transition: top .02s ease-out;
-o-transition: top .02s ease-out;
transition: top .02s ease-out;
}
.scrollToTop:hover i{
top:-20px;
}
.scrollToTop:hover{
background: rgba(0,0,0,1);
}
的持續時間是非常小的伴侶。如果你把它變成「2s」,你會注意到轉換:) – Harry
@Harry是對的..這裏是一個js小提琴http://jsfiddle.net/9f9fyaj2/1/ –