简体   繁体   English

如何单击具有CSS动画的div?

[英]how can i click a div with an css animation?

My div has a onclick function , and my css has an webkit translate animation 我的div有一个onclick函数,而我的css有一个webkit翻译动画

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

my script have a console log but doesn't trigger 我的脚本有一个控制台日志,但没有触发

.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);

  }
}

my plnk is similar but with jquery http://plnkr.co/edit/Qv1T4t9thBj8EIpdJUSH 我的plnk与jnk类似,但带有jQuery http://plnkr.co/edit/Qv1T4t9thBj8EIpdJUSH

if i unbind my animation this click works perfect 如果我取消绑定动画,则此点击效果最佳

The alert appears in the latest versions of firefox, and safari. 该警报显示在最新版本的Firefox和Safari中。

The movement works in safari, chrome but not in firefox. 该机芯适用于Safari和Chrome,但不适用于Firefox。

In Chrome I get the following error: 在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. 

I would say instead of linking to the raw.github address, download and host the file yourself. 我会说,与其链接到raw.github地址,不如直接下载并托管文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM