<tfoot id='MmMfZ'></tfoot>

    <small id='MmMfZ'></small><noframes id='MmMfZ'>

    <legend id='MmMfZ'><style id='MmMfZ'><dir id='MmMfZ'><q id='MmMfZ'></q></dir></style></legend>

    • <bdo id='MmMfZ'></bdo><ul id='MmMfZ'></ul>
  • <i id='MmMfZ'><tr id='MmMfZ'><dt id='MmMfZ'><q id='MmMfZ'><span id='MmMfZ'><b id='MmMfZ'><form id='MmMfZ'><ins id='MmMfZ'></ins><ul id='MmMfZ'></ul><sub id='MmMfZ'></sub></form><legend id='MmMfZ'></legend><bdo id='MmMfZ'><pre id='MmMfZ'><center id='MmMfZ'></center></pre></bdo></b><th id='MmMfZ'></th></span></q></dt></tr></i><div id='MmMfZ'><tfoot id='MmMfZ'></tfoot><dl id='MmMfZ'><fieldset id='MmMfZ'></fieldset></dl></div>

      1. 更改悬停时的动画速度

        时间:2023-11-29

          <legend id='GlyLN'><style id='GlyLN'><dir id='GlyLN'><q id='GlyLN'></q></dir></style></legend>

              <tbody id='GlyLN'></tbody>
          1. <tfoot id='GlyLN'></tfoot>
          2. <small id='GlyLN'></small><noframes id='GlyLN'>

            <i id='GlyLN'><tr id='GlyLN'><dt id='GlyLN'><q id='GlyLN'><span id='GlyLN'><b id='GlyLN'><form id='GlyLN'><ins id='GlyLN'></ins><ul id='GlyLN'></ul><sub id='GlyLN'></sub></form><legend id='GlyLN'></legend><bdo id='GlyLN'><pre id='GlyLN'><center id='GlyLN'></center></pre></bdo></b><th id='GlyLN'></th></span></q></dt></tr></i><div id='GlyLN'><tfoot id='GlyLN'></tfoot><dl id='GlyLN'><fieldset id='GlyLN'></fieldset></dl></div>
                  <bdo id='GlyLN'></bdo><ul id='GlyLN'></ul>
                  本文介绍了更改悬停时的动画速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在构建一个行星系统,它可以悬停在轨道上并且动画速度会发生变化.
                  我用 onMouseOver 和 .hover jquery 进行了尝试,但我不知道为什么它不起作用.

                  I'm building a planetsystem, where it is possible to hover over the orbit and the animation speed changes.
                  I tried it with the onMouseOver and .hover jquery, but I couldn't figure out why it wasnt working.

                  #universum-planet1 {
                    position: absolute;
                    height: 250px;
                    width: 250px;
                    top: 40%;
                    left: 50%;
                    margin-left: -125px;
                    margin-top: -65px;
                    z-index: 1;
                    border: 1px solid #989898;
                    -webkit-border-radius: 225px;
                    -moz-border-radius: 225px;
                    border-radius: 225px;
                    -webkit-animation: spin 15s linear infinite;
                    -moz-animation: spin 15s linear infinite;
                    animation: spin 15s linear infinite;
                    -moz-transform-origin: center center;
                    -webkit-transform-origin: center center;
                    transform-origin: center center;
                  }
                  #planet1 {
                    position: absolute;
                    top: 5%;
                    left: 5%;
                    height: 50px;
                    width: 50px;
                    z-index: 2;
                    -webkit-animation: spin 30s linear infinite;
                    -moz-animation: spin 30s linear infinite;
                    animation: spin 30s linear infinite;
                    -moz-transform-origin: center center;
                    -webkit-transform-origin: center center;
                    transform-origin: center center;
                  }
                  @-moz-keyframes spin {
                    100% {
                      -moz-transform: rotate(360deg);
                    }
                  }
                  @-webkit-keyframes spin {
                    100% {
                      -webkit-transform: rotate(360deg);
                    }
                  }
                  @keyframes spin {
                    100% {
                      -webkit-transform: rotate(360deg);
                      transform: rotate(360deg);
                    }
                  }

                  <div id="universum-planet1">
                    <div id="planet1">
                      <a href="universe.html" id="enterLink">
                        <img class="enter" src="http://webmaths.files.wordpress.com/2009/03/soccerball1.png" style="height:100%;" alt="" onMouseOver="this.src='http://www.rsg-shop.com/images/Ball-PASTORELLI-Giallo-Fluo-00014-0.jpg';" onMouseOut="this.src='http://webmaths.files.wordpress.com/2009/03/soccerball1.png'"
                        />
                      </a>
                    </div>
                  </div>

                  推荐答案

                  此解决方案使用具有相同关键帧动画(反转)的轨道包装器,它暂停/运行以更改悬停时的动画速度 :

                  This solution uses a wrapper for the orbit with the same keyframe animation (reversed) which pauses/runs to change the animation speed on hover :

                  演示

                  .wrapper{
                    position:absolute;
                    top:40%; left:50%;
                    margin-left:-125px;
                    margin-top:-65px;
                    width: 250px; height:250px;
                  
                    -webkit-animation:spin 20s linear infinite;
                    -moz-animation:spin 20s linear infinite;
                    animation:spin 20s linear infinite;
                  
                    -webkit-animation-direction: reverse;
                    -moz-animation-direction: reverse;
                    animation-direction: reverse;
                  
                    -webkit-animation-play-state: paused;
                    -moz-animation-play-state: paused;
                    animation-play-state: paused;
                  }
                  
                  #universum-planet1 {
                    height:250px; width: 250px;
                    z-index:1;
                    border: 1px solid #989898;
                    border-radius: 225px;
                    -webkit-animation:spin 15s linear infinite;
                    -moz-animation:spin 15s linear infinite;
                    animation:spin 15s linear infinite;
                    -moz-transform-origin:center center;
                    -webkit-transform-origin:center center;
                    transform-origin:center center;
                  }
                  #planet1 {
                    position:absolute;
                    top:5%; left:5%;
                    height: 50px; width: 50px;
                    z-index:2;
                    -webkit-animation:spin 30s linear infinite;
                    -moz-animation:spin 30s linear infinite;
                    animation:spin 30s linear infinite;
                    -moz-transform-origin:center center;
                    -webkit-transform-origin:center center;
                    transform-origin:center center;
                  }
                  .wrapper:hover{
                    -webkit-animation-play-state: running;
                    -moz-animation-play-state: running;
                    animation-play-state: running;
                  }
                  
                  @-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
                  @-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
                  @keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }

                  <div class="wrapper">
                    <div id="universum-planet1">
                      <div id="planet1"> <a href="universe.html" id="enterLink">
                        <img class="enter" src="http://webmaths.files.wordpress.com/2009/03/soccerball1.png" style="height:100%;" alt="" onMouseOver=   "this.src='http://www.rsg-shop.com/images/Ball-PASTORELLI-Giallo-Fluo-00014-0.jpg';" onMouseOut="this.src='http://webmaths.files.wordpress.com/2009/03/soccerball1.png'" /></a> 
                      </div>
                    </div>
                  </div>

                  这受到 this answer 的启发,作者为 Vals

                  This was inpired by this answer by Vals

                  这篇关于更改悬停时的动画速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使 css :hover 只影响父元素 下一篇:Jquery.Hover 不适用于动态元素

                  相关文章

                  <small id='CgSe1'></small><noframes id='CgSe1'>

                  • <bdo id='CgSe1'></bdo><ul id='CgSe1'></ul>
                • <i id='CgSe1'><tr id='CgSe1'><dt id='CgSe1'><q id='CgSe1'><span id='CgSe1'><b id='CgSe1'><form id='CgSe1'><ins id='CgSe1'></ins><ul id='CgSe1'></ul><sub id='CgSe1'></sub></form><legend id='CgSe1'></legend><bdo id='CgSe1'><pre id='CgSe1'><center id='CgSe1'></center></pre></bdo></b><th id='CgSe1'></th></span></q></dt></tr></i><div id='CgSe1'><tfoot id='CgSe1'></tfoot><dl id='CgSe1'><fieldset id='CgSe1'></fieldset></dl></div>

                    <legend id='CgSe1'><style id='CgSe1'><dir id='CgSe1'><q id='CgSe1'></q></dir></style></legend>

                    <tfoot id='CgSe1'></tfoot>