Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 将css动画暂停在悬停状态,然后从点继续_Jquery_Html_Css_Animation_Svg - Fatal编程技术网

Jquery 将css动画暂停在悬停状态,然后从点继续

Jquery 将css动画暂停在悬停状态,然后从点继续,jquery,html,css,animation,svg,Jquery,Html,Css,Animation,Svg,我正在尝试在悬停时添加svg路径动画,并在mouseOut时反转动画 如果mouseOut在mouseOn动画完成之前,如何暂停动画,并从该关键帧反转动画 此外,如果动画正在反转,你在动画中间悬停,我希望反转动画停止,然后从那个点向前播放。 我还使用jquery向元素添加属性。我是否只需要使用css来完成此操作 $(document).ready(function() { $('svg').hover(function() { /* Stuff to do when the mou

我正在尝试在悬停时添加svg路径动画,并在mouseOut时反转动画

如果mouseOut在mouseOn动画完成之前,如何暂停动画,并从该关键帧反转动画

此外,如果动画正在反转,你在动画中间悬停,我希望反转动画停止,然后从那个点向前播放。

我还使用jquery向元素添加属性。我是否只需要使用css来完成此操作

$(document).ready(function() {
  $('svg').hover(function() {
    /* Stuff to do when the mouse enters the element */
    $(this).find('circle').fadeIn(100);
    $(this).find('circle').attr("class", "social-circle movingCirc");
    console.log('on');
  }, function() {
    /* Stuff to do when the mouse leaves the element */
    $(this).find('circle').attr("class", "social-circle removingCirc");
    $(this).find('circle').delay(1900).fadeOut(100);
    console.log("hover off");
  });
});

感谢您的帮助

我不知道
笔划dashoffset
动画“停止并反转”是否可以用纯CSS动画来完成,但这里有一个使用的解决方案

下面是javascript:

$(function() {
  var $svg = $('svg');
  var $circle = $('circle', $svg);

  $svg.hover(function() {
    /* Stuff to do when the mouse enters the element */
    $circle
      .stop()
      .animate({
        'stroke-dashoffset': 0
      }, 2000);
  }, function() {
    /* Stuff to do when the mouse leaves the element */
    $circle
      .stop()
      .animate({
        'stroke-dashoffset': 900
      }, 2000);
  });
});

@我很乐意帮忙。你热情的感激使我高兴极了!