如何点击带有css动画的div?

时间:2013-09-26 04:27:36

标签: javascript html html5 css3 webkit

我的div有一个onclick函数,我的css有一个webkit翻译动画

<div class="ant animate" onclick="myFunction()"> </div>

我的脚本有控制台日志但不会触发

.animate{
  -webkit-animation: food 30s linear infinite;

}
.ant {
  width: 90px;
  height: 90px;
  background:black;
   pointer-events: none;
   z-index: 3000
}


@-webkit-keyframes food {
  0% {
    -webkit-transform: translate(0px,1000px);
  }
  100% {
    -webkit-transform: translate(0px,-1000px);

  }
}

我的plnk类似但是jquery http://plnkr.co/edit/Qv1T4t9thBj8EIpdJUSH

如果我取消绑定我的动画,则点击效果很好

1 个答案:

答案 0 :(得分:0)

警报出现在最新版本的firefox和safari中。

该机芯适用于safari,chrome,但不适用于firefox。

在Chrome中,我收到以下错误:

    Refused to execute script from 
    'https://raw.github.com/furf/jquery-ui-touch-punch/
    master/jquery.ui.touch-punch.js' 
    because its MIME type ('text/plain') is not executable, 
    and strict MIME type checking is enabled. 

我想说的是不是链接到raw.github地址,而是自己下载并托管文件。