关键帧动画不适用于chrome safari或mozilla,但适用于opera,vivaldi和ie

时间:2015-12-16 16:38:17

标签: css animation cross-browser

我的关键帧动画并不适用于chrome,safari或mozilla,但适用于歌剧,vivaldi和Internet Explorer (它是在bootstrap和wordpress中制作的)

示例链接"< terug" http://motico.be/dienst/offleash-training/

my Less:

@keyframes gotolink {
  0% {
    transform:translateX(0px);
  }
  50% {
   transform:translateX(-20px);
  }
  100% {
    transform:translateX(0px);
  }
}

@-webkit-keyframes gotolink {
  0% {
    -webkit-transform:translateX(0px);
  }
  50% {
   -webkit-transform:translateX(-20px);
  }
  100% {
    -webkit-transform:translateX(0px);
  }
}
@-moz-keyframes gotolink {
  0% {
    -moz-transform:translateX(0px);
  }
  50% {
   -moz-transform:translateX(-20px);
  }
  100% {
    -moz-transform:translateX(0px);
  }
}

#titelveld {

    background-color:@grey;
    width:100%;
    padding:10px 0;

    h1 {
        text-align:left !important;
        font-weight:300;

    }

    a {
        margin-top: 10px;
        padding:20px 0; 
        font-size:16px;

        color:@appelblauwzeegroen;
        -webkit-transition: all 0.2s ease-in-out;
        -moz-transition: all 0.2s ease-in-out;
        -o-transition: all 0.2s ease-in-out;
        transition: all 0.2s ease-in-out; 

        &:hover {
            text-decoration:none;
            color:@blue;

                span {

                    -webkit-animation-duration: 0.5s;
                    -moz-animation-duration: 0.5s;
                    animation-duration: 0.5s;
                    -webkit-animation-name: gotolink;
                    -moz-animation-name: gotolink;
                    animation-name: gotolink;

                }
        }
        &:focus {
            text-decoration:none;
        }
    }

}

HTML:

<section id='titelveld'>
    <div class='container'>
        <div class='row'>
            <div class='col-md-6 col-sm-6 col-xs-8'>
                <h1 class='animated fadeIn'><?php the_field('hoofdtitel'); ?></h1>
            </div>
            <div class='col-md-6 col-sm-6 col-xs-4'>
                <a href='<?php echo $_SERVER['HTTP_REFERER']; ?>' class=' pull-right animated fadeIn'><span>&lt;</span> Terug</a>
            </div>
        </div>
    </div>
</section>

1 个答案:

答案 0 :(得分:0)

span必须是display

的默认inline属性之外的其他内容

将其设置为inline-block可以修复它。

Codepen Demo

@keyframes gotolink {
  0% {
    -webkit-transform: translateX(0px);
    transform: translateX(0px);
  }
  50% {
    -webkit-transform: translateX(-20px);
    transform: translateX(-20px);
  }
  100% {
    -webkit-transform: translateX(0px);
    transform: translateX(0px);
  }
}
@-webkit-keyframes gotolink {
  0% {
    -webkit-transform: translateX(0px);
  }
  50% {
    -webkit-transform: translateX(-20px);
  }
  100% {
    -webkit-transform: translateX(0px);
  }
}
#titelveld {
  width: 100%;
  padding: 10px 0;
}
#titelveld h1 {
  text-align: left !important;
  font-weight: 300;
}
#titelveld a {
  margin-top: 10px;
  padding: 20px 0;
  font-size: 16px;
  color: green;
  -webkit-transition: all 0.2s ease-in-out;
  transition: all 0.2s ease-in-out;
}
#titelveld a:hover {
  text-decoration: none;
  color: blue;
}
#titelveld a:hover span {
  display: inline-block;
  -webkit-animation-duration: 0.5s;
  animation-duration: 0.5s;
  -webkit-animation-name: gotolink;
  animation-name: gotolink;
}
#titelveld a:focus {
  text-decoration: none;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<section id="titelveld">
  <div class="container">
    <div class="row">
      <div class="col-sm-6 col-xs-8">
        <h1 class="animated fadeIn">Some Text</h1>
      </div>

      <div class="col-sm-6 col-xs-4">
        <a href="#" class="pull-right animated fadeIn"><span>></span>Terug</a>
      </div>
    </div>
  </div>
</section>

相关问题