【问题标题】:Map marker animation working in Firefox but not in Chrome/Safari地图标记动画在 Firefox 中有效,但在 Chrome/Safari 中无效
【发布时间】:2013-08-27 05:33:57
【问题描述】:

我一直在尝试制作一个简单的 CSS 动画。在此处查看this link 以获取演示。

在 Firefox 中它运行良好,但我无法让它在 Chrome/Safari 中运行。

我的 CSS 代码是 ~

.pin {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  background: #00cae9;
  position: absolute;
  transform: rotate(-45deg);
  left: 50%;
  margin: -20px 0 0 -20px;
}
.pin:after {
  content: "";
  width: 14px;
  height: 14px;
  margin: 8px 0 0 8px;
  background: #e6e6e6;
  position: absolute;
  border-radius: 50%;
}

.bounce {
  animation-name: bounce;
  animation-fill-mode: both;
  animation-duration: 1s;
}

.pulse {
  background: #d6d4d4;
  border-radius: 50%;
  height: 14px;
  width: 14px;
  position: absolute;
  left: 50%;
  margin: 11px 0px 0px -12px;
  transform: rotateX(55deg);
  z-index: -2;
}
.pulse:after {
  content: "";
  border-radius: 50%;
  height: 40px;
  width: 40px;
  position: absolute;
  margin: -13px 0 0 -13px;
  animation: pulsate 1s ease-out;
  animation-iteration-count: infinite;
  opacity: 0;
  box-shadow: 0 0 1px 2px #00cae9;
  animation-delay: 1.1s;
}

@keyframes pulsate {
  0% {
    transform: scale(0.1, 0.1);
    -webkit-transform: scale(0.1, 0.1);
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    transform: scale(1.2, 1.2);
    -webkit-transform: scale(1.2, 1.2);
    opacity: 0;
  }
}
@-webkit-keyframes pulsate {
  0% {
    transform: scale(0.1, 0.1);
    -webkit-transform: scale(0.1, 0.1);
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    transform: scale(1.2, 1.2);
    -webkit-transform: scale(1.2, 1.2);
    opacity: 0;
  }
}

@keyframes bounce {
  0% {
    opacity: 0;
    transform: translateY(-2000px) rotate(-45deg);
    -webkit-transform: translateY(-2000px) rotate(-45deg);
  }

  60% {
    opacity: 1;
    transform: translateY(30px) rotate(-45deg);
    -webkit-transform: translateY(30px) rotate(-45deg);
  }

  80% {
    transform: translateY(-10px) rotate(-45deg);
    -webkit-transform: translateY(-10px) rotate(-45deg);
  }

  100% {
    transform: translateY(0) rotate(-45deg);
    -webkit-transform: translateY(0) rotate(-45deg);
  }
}

@-webkit-keyframes bounce {
  0% {
    opacity: 0;
    transform: translateY(-2000px) rotate(-45deg);
    -webkit-transform: translateY(-2000px) rotate(-45deg);
  }

  60% {
    opacity: 1;
    transform: translateY(30px) rotate(-45deg);
    -webkit-transform: translateY(30px) rotate(-45deg);
  }

  80% {
    transform: translateY(-10px) rotate(-45deg);
    -webkit-transform: translateY(-10px) rotate(-45deg);
  }

  100% {
    transform: translateY(0) rotate(-45deg);
    -webkit-transform: translateY(0) rotate(-45deg);
  }
}

谁能指出我哪里出错了?

【问题讨论】:

    标签: css google-chrome webkit transform css-animations


    【解决方案1】:

    您忘记在动画和变换中添加 -webkit-。在 chrome 中检查这个小提琴它的工作 http://jsfiddle.net/Gt4rP/2/

    CSS

    .pin {
      width: 30px;
      height: 30px;
      border-radius: 50% 50% 50% 0;
      background: #00cae9;
      position: absolute;
      -webkit-transform: rotate(-45deg);
        transform: rotate(-45deg);
      left: 50%;
      margin: -20px 0 0 -20px;
    }
    .pin:after {
      content: "";
      width: 14px;
      height: 14px;
      margin: 8px 0 0 8px;
      background: #e6e6e6;
      position: absolute;
      border-radius: 50%;
    }
    
    .bounce {
      -webkit-animation-name: bounce;
      -webkit-animation-fill-mode: both;
      -webkit-animation-duration: 1s;
        animation-name: bounce;
      animation-fill-mode: both;
      animation-duration: 1s;
    }
    
    .pulse {
      background: #d6d4d4;
      border-radius: 50%;
      height: 14px;
      width: 14px;
      position: absolute;
      left: 50%;
      margin: 11px 0px 0px -12px;
        transform: rotateX(55deg);
      -webkit-transform: rotateX(55deg);
      z-index: -2;
    }
    .pulse:after {
      content: "";
      border-radius: 50%;
      height: 40px;
      width: 40px;
      position: absolute;
      margin: -13px 0 0 -13px;
      -webkit-animation: pulsate 1s ease-out;
      -webkit-animation-iteration-count: infinite;
      opacity: 0;
      box-shadow: 0 0 1px 2px #00cae9;
      -webkit-animation-delay: 1.1s;
        animation: pulsate 1s ease-out;
      animation-iteration-count: infinite;
    animation-delay: 1.1s;
    }
    

    【讨论】:

      猜你喜欢
      • 2021-10-29
      • 1970-01-01
      • 1970-01-01
      • 2011-12-12
      • 2020-04-04
      • 1970-01-01
      • 1970-01-01
      • 2022-08-04
      • 2014-08-04
      相关资源
      最近更新 更多