michaelmcgurk
michaelmcgurk

Reputation: 6509

Disable CSS animation effect in IE

I am using a cool "pop" hover effect in CSS which looks great in Chrome.

However, in Internet Explorer 11 (and below) the box area goes blank on hover and then black.

Is there a way to disable this in IE or at least fix the glitch where it disappears briefly?

Demo: http://jsfiddle.net/0hLLkyh3/

@import url(http://fonts.googleapis.com/css?family=Roboto);
 h2 {
  font-size: 18px;
  margin-bottom: 20px;
  line-height: 28px;
  margin-top: 0;
  font-weight: 900;
}
.effects {} body {
  margin: 0 auto;
  max-width: 800px;
  padding: 40px 20px 20px 20px;
  font-family: sans-serif;
  color: #333;
  line-height: 140%;
}
img {
  border: none;
}
small {
  display: block;
}
p,
[class^="hvr-"] {
  font-family: 'Roboto', sans-serif;
}
[class^="hvr-"] {
  /*display: inline-block;*/
  /*vertical-align: middle;*/
  margin: .4em;
  padding: 1em;
  cursor: pointer;
  background: #e1e1e1;
  text-decoration: none;
  color: #666;
  /* Prevent highlight colour when element is tapped */
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.aligncenter {
  text-align: center;
}
a {
  color: #2098D1;
  text-decoration: none;
}
.mt-30 {
  margin-top: 30px;
}
a:hover {
  background: black
}
/*!
     * Hover.css (http://ianlunn.github.io/Hover/)
     * Version: 2.0.2
     * Author: Ian Lunn @IanLunn
     * Author URL: http://ianlunn.co.uk/
     * Github: https://github.com/IanLunn/Hover
    
     * Made available under a MIT License:
     * http://www.opensource.org/licenses/mit-license.php
    
     * Hover.css Copyright Ian Lunn 2014. Generated with Sass.
     */

/* 2D TRANSITIONS */

/* Pop */

@-webkit-keyframes web-hvr-pop {
  50% {
    -webkit-transform: scale(1.2);
    transform: scale(1.2);
  }
}
@keyframes hvr-pop {
  50% {
    -webkit-transform: scale(1.2);
    transform: scale(1.2);
  }
}
.hvr-pop {
  display: inline-block;
  vertical-align: middle;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -moz-osx-font-smoothing: grayscale;
}
.hvr-pop:hover,
.hvr-pop:focus,
.hvr-pop:active {
  -webkit-animation-name: web-hvr-pop;
  animation-name: hvr-pop;
  -webkit-animation-duration: 0.3s;
  animation-duration: 0.3s;
  -webkit-animation-timing-function: linear;
  animation-timing-function: linear;
  -webkit-animation-iteration-count: 1;
  animation-iteration-count: 1;
}
<div class="effects">
  <a class="hvr-pop" href="#">Pop</a>
</div>

Upvotes: 3

Views: 3178

Answers (1)

Hitesh Misro
Hitesh Misro

Reputation: 3461

-ms-animation-name:none; would fix that

@import url(http://fonts.googleapis.com/css?family=Roboto);
h2{
    font-size:18px;
    margin-bottom: 20px;
    line-height: 28px;
    margin-top:0;
    font-weight: 900;
}
.effects{
    
}
 body {
    margin: 0 auto;
    max-width: 800px;
    padding: 40px 20px 20px 20px;
    font-family: sans-serif;
    color: #333;
    line-height: 140%;
}
img {
    border: none;
}
small {
    display: block;
}
p, [class^="hvr-"] {
    font-family:'Roboto', sans-serif;
}
[class^="hvr-"] {
    /*display: inline-block;*/
    /*vertical-align: middle;*/
    margin: .4em;
    padding: 1em;
    cursor: pointer;
    background: #e1e1e1;
    text-decoration: none;
    color: #666;
    /* Prevent highlight colour when element is tapped */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.aligncenter {
    text-align: center;
}

a {
    color: #2098D1;
    text-decoration: none;
}

.mt-30{
    margin-top:30px;
}

a:hover {
  background:black
}

/*!
 * Hover.css (http://ianlunn.github.io/Hover/)
 * Version: 2.0.2
 * Author: Ian Lunn @IanLunn
 * Author URL: http://ianlunn.co.uk/
 * Github: https://github.com/IanLunn/Hover

 * Made available under a MIT License:
 * http://www.opensource.org/licenses/mit-license.php

 * Hover.css Copyright Ian Lunn 2014. Generated with Sass.
 */
/* 2D TRANSITIONS */

/* Pop */
@-webkit-keyframes web-hvr-pop {
  50% {
    -webkit-transform: scale(1.2);
    transform: scale(1.2);
  }
}

@keyframes hvr-pop {
  50% {
    -webkit-transform: scale(1.2);
    transform: scale(1.2);
  }
}

.hvr-pop {
  display: inline-block;
  vertical-align: middle;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -moz-osx-font-smoothing: grayscale;
}
.hvr-pop:hover, .hvr-pop:focus, .hvr-pop:active {
  -webkit-animation-name: web-hvr-pop;
  -moz-animation-name: web-hvr-pop;
  animation-name: hvr-pop;
  -ms-animation-name:none;
  -moz-animation-duration: 0.3s;
  -webkit-animation-duration: 0.3s;
  animation-duration: 0.3s;
  -webkit-animation-timing-function: linear;
  animation-timing-function: linear;
  -webkit-animation-iteration-count: 1;
  animation-iteration-count: 1;
}
<div class="effects">
    <a class="hvr-pop" href="#">Pop</a>
</div>

Upvotes: 4

Related Questions