简体   繁体   English

jQuery / CSS-transform:rotate(0deg)不起作用

[英]Jquery/CSS - transform:rotate(0deg) not working

Context: I am creating a basic animation, where in a boy figure walks upto a girl's figure and stops. 上下文:我正在创建一个基本动画,其中一个男孩的身姿走到一个女孩的身姿并停下来。 I am using CSS3- translate to achieve it. 我正在使用CSS3转换来实现它。 To stop the hand and leg from moving I am using Javascript event - 为了阻止手脚移动,我正在使用Javascript事件-

boy.addEventListener("webkitAnimationEnd", animation_end);

and the finally Jquery 最后是Jquery

$('#boy-right-leg').css('-webkit-animation-play-state','paused');

I want the legs to be straight, however it is crossed. 我希望腿保持笔直,但要交叉。

function animation_end() {
  $('#boy-right-leg').css('-webkit-animation-play-state','paused');
  $('#boy-left-hand').css('-webkit-animation-play-state','paused');
  $('#boy-left-leg').css('-webkit-animation-play-state','paused');
  $('#boy-right-leg').css('-webkit-transform','rotate(0deg)');
  $('#boy-left-leg').css('-webkit-transform','rotate(0deg)');
}

Issue: The CSS function in Jquery is not working. 问题:Jquery中的CSS函数不起作用。 The legs are still crossed.The legs should be straight. 腿仍然交叉,腿应该是笔直的。

Please let me how to fix it? 请让我如何解决?

Browser - Safari. 浏览器-Safari。

whole code - http://codepen.io/tusharsaurabh/pen/QKXXmY 整个代码-http://codepen.io/tusharsaurabh/pen/QKXXmY

Please note - 1. My code has mix of Jquery and Javascript, as I started with Javascript but to solve the issue I tried many things and slowly moved to Jquery. 请注意-1.我的代码混用了Jquery和Javascript,从我开始使用Javascript开始,但是为了解决该问题,我尝试了很多事情,然后慢慢转移到Jquery。

When you change the value of 'animation-play-state' to 'paused' the transform stays with the value it has at that same moment. 当您将“动画播放状态”的值更改为“已暂停”时,转换将保持在同一时刻的值。

To remove that value you can change the 'animation-iteration-count' to 1 for example, or remove the animation by changing its value to 'none'. 要删除该值,您可以将“ animation-iteration-count”更改为1,或者通过将其值更改为“ none”来删除动画。 But notice the value wont transition, it will simply jump. 但是请注意,值不会过渡,它只会跳跃。

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

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