简体   繁体   English

CSS过渡和动画问题

[英]CSS transition and animation issue

Fiddle - I am creating a small button for the top right corner of my page, which initially has an animation to hide it after a certain time. 小提琴 -我在页面的右上角创建了一个小按钮,该按钮最初具有动画以在一段时间后将其隐藏。 After this animation, the button is supposed to be able to move when a div is hovered on, but currently the :hover event is not working.Here is my CSS code: 播放完该动画后,当div悬停时,该按钮应该可以移动,但当前:hover事件不起作用,这是我的CSS代码:

.siteTagArea {
    width: 80px;
    height: 40px;
    position: absolute;
    right: 0px;
    top: 0px;
    z-index: 9;
}

.siteTag {
    width: 60px;
    height: 20px;
    position: absolute;
    right: 10px;
    top: 10px;
    text-align: center;
    border-radius: 3px;
    line-height: 20px;
    font-size: 10px;
    text-transform: uppercase;
    border: none;
    border-bottom: 2px solid rgba(0, 0, 0, 0.2);
    background-color: rgba(0, 0, 0, 0.4);
    color: #fff;
    z-index: 10;
    -webkit-transition: 0.2s;
    -webkit-animation: moveup 2s 1;
    -webkit-animation-delay: 2s;
    -webkit-animation-fill-mode: forwards;
}

@-webkit-keyframes moveup {
    from {top: 10px;}
    to {top: -22px;}
}

.siteTagArea:hover + .sazookTag {
    top: 10px;
}

.siteTag:hover {
    top: 10px;
}

How would I fix this bug? 我该如何解决这个错误?

The animation was messing with it so if you change to have an animation bring it back down it seems to work http://jsfiddle.net/66vd5g3b/4/ 动画令人困惑,因此,如果您更改为将动画放回原处,似乎可以正常使用http://jsfiddle.net/66vd5g3b/4/

 @-webkit-keyframes movedown {
        from {top: -22px;}
        to {top: 10px;}
}

.siteTagArea:hover + .siteTag {
        -webkit-animation: movedown 2s 1;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM