好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

移动端:active,:hover无法很好触发动画的解决方案_html/css_WEB-ITnose

移动端:active,:hover无法很好触发动画的解决方案

1:问题环境:

用css3定义了一个动画,使用:hover伪类调用动画时在移动端不能很好的进行动画.

2:解决方案:

定义一个open类,满足open类的情况下触发动画

使用js事件去控制动画,当滑动的时候加上open类,然后延迟与动画相同的时间移除open类

这样就能很好的控制动画了

3:附上demo

                                                        .nav{width:100%;height: 200px;background-color: blue;}            /*动画调用满足条件*/            .nav.open{-webkit-animation:change 2s linear running}            /*定义动画*/            @-webkit-keyframes change{                from{height: 200px;}                to{height: 300px;}            }                           

查看更多关于移动端:active,:hover无法很好触发动画的解决方案_html/css_WEB-ITnose的详细内容...

  阅读:32次